public static bool Compare(Employ e1, Employ e2) { if (e1.Money < e2.Money) { return(false); } else { return(true); } }
static void Main(string[] args) { // int[] myarry = new int[] { 156, 68544, 632, 21654, 85, 5, 163, 35, 654, 45, 5, 64354 }; // sort(myarry); // foreach (var temp in myarry) // { // Console.Write(temp + " "); // } Employ[] em = new Employ[] { new Employ("as", 465), new Employ("ass", 15), new Employ("a1s", 46585), new Employ("aass", 4675), }; Compare <Employ>(em, Employ.Compare); foreach (Employ em1 in em) { Console.Write(em1.ToString() + "|"); } Console.ReadKey(); }