7
Reply

2-D char array into Strings

Jayakrishna

Jayakrishna

Oct 22 2007 12:58 PM
2.5k

Hi, I'm new to C#.

I have a 2-D char array as follows:

char [,] c_Line = new c_Line[45,1000];

Then in the program, I will fill-in elements in this 2-D array like c_Line[x, y] = 'X', etc.  At the end I would have c_Line filled with characters.

Now, I want to take the first row, i.e., c_Line[0] (I'm from C/C++, there c_Line[0] would represent the whole first row) and convert into String object.

So if I do this, it gives compilation error that it expects the 2nd component in the [].

String s_FirstRec = new String (c_Line[0].ToString());

How do I convert this 2-D char array into 45 String objects?

Please advise.

Thanks./


Answers (7)