views:

9

answers:

0

I am developing the asp.net mobile application. I am using xml as a database. In the following xml file I am retriving the all the attributes by using LINQ to xml. In this way there are nearly 10 to 30 attributes. I am adding the values of these attributes dynamically into the Hashtable.

In coding part I am using following code

public class Server { public Hashtable Properties = new Hashtable();

}

In one method I am using following code

count=FieldRoot.Element("FIELD-DEFINITION").Element("SERVERS").Elements("SERVER").Count();

    Server []Serverobj = new Server[count];
    count = 0;

    foreach (var element in FieldRoot.Element("FIELD-DEFINITION").Element("SERVERS").Elements())
    {

        Serverobj[count] = new Server();

        foreach (var attribute in element.Attributes())
        {
            string AttNm = attribute.Name.ToString();
            string AttVal = attribute.Value.ToString();
            Serverobj[count].Properties.Add(AttNm, AttVal);
            AttValue.Add(AttVal);
        }

        count++;
    }

In this way once an attribute is added in xml file it automatically gets added into the Hashtable collection. I am not aware of the performance features of different types of key value pairs.Can you please tell me which collection I should use in above situation ? & why ? Can you please explain me in which situation which collection (key-value pair collection) should be used & which not ?