I am getting error of IndexOutOfRangeException in the following code.
public static string parseVidPid()
{
DataSet myDs = new DataSet();
// Get a FileStream object.
FileStream myFs = new FileStream(PidVidPath, FileMode.Open, FileAccess.Read);
// Apply the ReadXml(fileStream method) to read the file
myDs.ReadXml(myFs);
DataTable myDt = myDs.Tables[0];
int no = myDt.Rows.Count;
String[] nodeVal = new String[no];
for (int i = 0; i < myDt.Rows.Count; i++)
{
nodeVal[i] = myDt.Rows[i].ToString();
Console.WriteLine("Inside parseVidPid- Row = " + nodeVal[i]);
}
myFs.Close();
return nodeVal[no];
}
Where XML file is having 2 nodes. can anybody tell me where is the issue?