public void SortData() { AdditionalHints.ContainerFields(); Console.Write("Select the field by which collection will be sorted: "); int Operation = SearchIndexes.SearchOpeationNumber(); Sorting(Operation); Console.WriteLine("\nContainers has been sorted\n"); }
public void SortData() { ContainerFields(); Console.Write("Select the field by which collection will be sorted: "); int Operation = SearchIndexes.SearchOpeationNumber(); Containers.Sort((x, y) => TypeDescriptor.GetProperties(x)[Operation - 1] .GetValue(x).ToString() .CompareTo(TypeDescriptor.GetProperties(y)[Operation - 1] .GetValue(y).ToString())); Console.WriteLine("\nObjects has been sorted\n"); }
static void Main(string[] args) { var СontainerCollection = new Collection <Container>(); СontainerCollection.ReadConatainerDateFromFile(); AdditionalHints.Menue(); while (true) { int OpeationNumber = SearchIndexes.SearchOpeationNumber(); switch (OpeationNumber) { default: break; case 1: СontainerCollection.SearchAllSimilarity(); break; case 2: СontainerCollection.SortData(); break; case 3: СontainerCollection.DeleateContainer(); break; case 4: СontainerCollection.AddContainer(); break; case 5: СontainerCollection.EditContainer(); break; case 6: СontainerCollection.OutputContairnsInformation(); break; case 7: СontainerCollection.Exit(); break; } AdditionalHints.MenueHint(); ConsoleKey key = Console.ReadKey().Key; if (key is ConsoleKey.Add) { AdditionalHints.Menue(); } } }