public int Compare(object x, object y) { ProductsSortingInCSharp1 first = (ProductsSortingInCSharp1)x; ProductsSortingInCSharp1 second = (ProductsSortingInCSharp1)y; return(first.Name.CompareTo(second.Name)); }
public static void PrintOrderedSampleProducts() { ArrayList products = ProductsSortingInCSharp1.GetSampleProducts(); products.Sort(new ProductNameComparer_1()); foreach (ProductsSortingInCSharp1 product in products) { Console.WriteLine(product.name); } }