Hi,
I'm having trouble with declaring 2-dimensional arrays in C#, populating them and then returning the array.
At the moment, I'm declaring the array like so:
private static string[,] _programData = new String[50,50];
public string[,] ProgramData
{
get
{
return _programData;
}
}
programData is showing the error 'cannot implicitly convert from type 'string[,*] to string[][]'
I should point out that I am attempting to call ProgramData from another class like so:
for (serviceCount = 0; serviceCount <= ffm.Program.Length; serviceCount++)
{
Console.WriteLine("Program Number: " + ffm.Program[serviceCount].ToString());
for (serviceDataCount = 0; serviceDataCount <= ffm.ProgramData.Length; serviceDataCount++)
{
**Console.WriteLine("\t" + ffm.ProgramData[serviceCount, serviceDataCount].ToString());**
}
}
Error occurs on the bold line above with:
Object reference not set to an instance of an object.
I don't think there seems to be an issue with how I've declared the array, its just the type mismatch that I don't understand.
Regards