When you want to sort a generic List you'll have to implement a simple IComparer class. You can sort based on a string comarer or use objects, Eg. datetime. This example implements a string comparer. PCLOC is the object and PK is the property of the object on which we want to sort the list.

public class ToStringComparer : IComparer
{
public int Compare(object x, object y)
{
return ((PCLOC)x).PK.ToString().CompareTo(((PCLOC)y).PK.ToString());
}
}
 
public List<PCLOC> SortIList(List<PCLOC> list)
{
ArrayList.Adapter((IList)list).Sort(new ToStringComparer());
return list;
}
 

Now when you want to sort you're List, you just call following code:

returnList = SortIList(returnList);
 

When you use the generic list for a regular string or int object, you can use the IList .Sort() method!

List<string> roomsList = new List<string>();
foreach (XmlNode nod in list)
{
foreach (XmlNode room in nod.ChildNodes)
{
	roomsList.Add(room.Attributes["id"].Value);
}
}
roomsList.Sort();
 

Hope this helps?