Writing to a 2 dimensional string array

  • Thread starter Thread starter ananda vardhana
  • Start date Start date
A

ananda vardhana

Guest
As you can see I am new to C# I tried many things it just would not work. Please suggest a fix for the the two lines with the comment.

using System;
using System.Xml.Linq;

class Program
{
static void Main(string[] args)
{
string Event1 = "<Event MSec= \"14710.1843\" PID=\"1820\" PName= \"\" TID=\"21844\" EventName=\"ErrorEvent\" ProviderName=\"Abcd\" ErrorMsg=\"The brown fox jumps over the white moon \" ErrorID=\"4,660\"/>";
string[, ,] EventData = new string[100, 100, 1000]; // Array with 100 elements, string one 100 char length, string 2 1000 char length

var xdoc = XDocument.Parse(Event1);
var root = xdoc.Root;
int i = 0;

foreach (var node in xdoc.DescendantNodes())

foreach (XElement element in xdoc.Descendants("Event"))
{
foreach (XAttribute attrib in element.Attributes())
{
Console.WriteLine(String.Format("\t{0}={1}\n", attrib.Name, attrib.Value));
//I want to store attrib.Name, attrib.Value in a 2 dimensional string array
EventData[i++] = {{attrib.Name, attrib.Value}}; // This does not work
}
}
}
}

Thanks

Continue reading...
 
Back
Top