Hi folks,
I need to build a jagged array out from a text file, where each line will be an array inside the Jagged Array.
How can i achieve this,if it is possible, regarding that the text file will always be diffent, will always have a different number of lines.
It must be a Jagged Array because it is an input parameter of an external web service method.
I greatly appreciate your help.
AlanPosted Oct 3, 2008, 6:32 PM
Something like this perhaps (.NET 2.0 or later assumed):
string[] lines = System.IO.File.ReadAllLines("tiago.txt");
char[][] jagged = new char[lines.Length][];
for(int i = 0; i < lines.Length; i++)
{
jagged[i] = lines[i].ToCharArray();
}