Tuesday, July 14, 2009

Casting string to array in C#.net?

i have done this casting.


what's wrong with it?


exception is-unable to cast string type to array


public Array getRange(string startCell, string endCell)


{





Range range = currentWorksheet.get_Range(startCell, endCell); //Get the cells


//Array array = (System.Array)currentWorksheet.get_Range... endCell);


System.Array array = (System.Array)range.Cells.get_Value(null... the values of the cells


return array;


}

Casting string to array in C#.net?
Umm, it'd help if you say what type of array you're trying to create. If you just want an array of chars then use ToCharArray:





string myString = "This is a string";


char[] myChars = myString.ToCharArray();

buy flowers

No comments:

Post a Comment