using System;
using System.Collections;namespace test2
{
struct Eployee
{
public string  name;
public int age;
public string sex;
}
class Class1
{
[STAThread]
static void Main(string[] args)
{
Eployee ep1=new Eployee();
ep1.name="小张";
ep1.age=21;
ep1.sex="男";
Eployee ep2=new Eployee();
ep2.name="老李";
ep2.age=43;
ep2.sex="男";
Eployee ep3=new Eployee();
ep3.name="施施";
ep3.age=18;
ep3.sex="男"; ArrayList EmployeeList=new ArrayList();
EmployeeList.Add(ep1);
EmployeeList.Add(ep2);
EmployeeList.Add(ep3); myEmployeeCompare mye=new myEmployeeCompare();
EmployeeList.Sort(mye);
for(int i=EmployeeList.Count;i>0;i--)
{
Console.WriteLine(((Eployee)EmployeeList[i]).name);
}
}
}
class myEmployeeCompare:System.Collections.IComparer 
{
public int Compare(object x,object y)
{
return ((Eployee)x).age-((Eployee)y).age;
}
}
}