Possible Duplicate:
How to sort an array of object by a specific field in C#?
Given the following code:
MyClass myClass;
MyClassArray[] myClassArray = new MyClassArray[10];
for(int i; i < 10; i++;)
{
myClassArray[i] = new myClass();
myClassArray[i].Name = GenerateRandomName();
}
The end result could for example look like this:
myClassArray[0].Name //'John';
myClassArray[1].Name //'Jess';
myClassArray[2].Name //'James';
How would you sort the MyClassArray[] array according to the myClass.Name property alphabetically so the array will look like this in the end:
myClassArray[0].Name //'James';
myClassArray[1].Name //'Jess';
myClassArray[2].Name //'John';
*Edit: I'm using VS 2005/.NET 2.0.