Отсортировать структуру по возрастанию
Не знаю как сортировать структуру по возростанию номера рейса
public struct Aeroflot
{
public string Destination;
public string Number;
public string PlaneModel;
}
class Program
{
static void GetValues(Aeroflot[] Flights)
{
for (int i = 0; i < NUMBER_OF_FLIGHTS; i++)
{
Aeroflot flight = new Aeroflot();
Console.WriteLine("Input destination");
flight.Destination = Console.ReadLine();
Console.WriteLine("Input flight number");
flight.Number = Console.ReadLine();
Console.WriteLine("Input plane model");
flight.PlaneModel = Console.ReadLine();
Flights[i] = flight;
}
}
const int NUMBER_OF_FLIGHTS = 2;
public static void Main(string[] args)
{
Aeroflot[] Flights = new Aeroflot[NUMBER_OF_FLIGHTS];
GetValues(Flights);
int matches = 0;
string DestinationToCompare = Console.ReadLine();
for (int i=0; i<Flights.Length; i++)
{
if (Flights[i].Destination == DestinationToCompare)
{
Console.WriteLine(Flights[i].Number + " " + Flights[i].PlaneModel + " " + Flights[i].Destination);
matches++;
}
}
if (matches == 0)
{
Console.WriteLine("There is no matches");
}
}
}