7
Answers

2-D char array into Strings

Jayakrishna

Jayakrishna

17y
2.5k
1

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)