C# Developers' Journal (original) (raw)

10:18p

String[] / ArrayList Problems I've written a class that queries game servers on the on the Quake3 network type, and I've come into a small problem. After you send the status packet to the server, it responds back with one packet, with each part being separated by a line break. (Line 1 = useless start, Line 2 = Server Info, Line 3 = Playerinfo.) After I split it, (using '\n') I can easily access each part, but not in the way I need to. All I need to do is add _Response[1] to the arraylist, but I get an error... heres what I tried.

string[] _newResponse = _Response.Spilt('\n');Console.WriteLine(_newResponse[0]); // Outputs the useless packet start
Console.WriteLine(_newResponse[1]); // Outputs all server info
Console.WriteLine(_newResponse[2]); // Outputs all player info

foreach(string Val in _newResponse[1]) // ERROR: Cannot convert type 'char' to 'string'
{
ServerVars.Add(Val);
}

Any ideas? Thanks.