3
Answers

Unable to assign string value to 2D array

Sasikumar S

Sasikumar S

13y
1.7k
1
Hi friends,
While i am trying to parse the string and assign each string into two dimensional array it raising errors. my code shown below

String[][] location =null;
String sIPAddress="Chennai@tamilnadu@india");
int j = 0;
rt.Text = string.Empty;
for (int i = 0; i < sIPAddress.Length; i++)
{
ipvalue = sIPAddress[i].ToString();
locate= getlocate(ipvalue);
String[] str = locate.Split('@');
foreach(string place in str)
{
j = j + 1;
location[i][j] = place;
}
j = 0;
}


error message:

Object reference not set to an instance of an object


is there any solutions to solve this problem..

regards
sasi

Answers (3)