Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // List<int> liczby = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
- // foreach (int liczba in liczby)
- // {
- // if (liczba % 2 == 0)
- // {
- // System.Console.WriteLine(liczba);
- // }
- // }
- // var parzyste = liczby.Where(x => x % 2 == 0).ToList();
- // foreach (var n in parzyste)
- // {
- // System.Console.WriteLine(n);
- // }
- // List<string> imiona = new List<string> { "Wojtek", "Hania", "Szymon", "Zosia" };
- // var posortowane = imiona.OrderByDescending(imie => imie).ToList();
- // foreach (var imie in posortowane)
- // {
- // System.Console.WriteLine(imie);
- // }
- // var min = liczby.Min();
- // System.Console.WriteLine(min);
- // System.Console.WriteLine(liczby.Max());
- // System.Console.WriteLine(liczby.Sum());
- // System.Console.WriteLine(liczby.Average());
- // Utwórz listę studentów. Lista ma zawierać 4 studentów.
- // Każdy student ma imie, wiek i średnią ocen.
- // Student jest osobnym obiektem.
- // Używając LINQ (wyrażenia Where) filtruj listę studentów do tych,
- // którzy mają więcej niż 20 lat. Pamiętajmy, żeby dodać klasę
- // Student oraz klasę programu z metodą Main.
- public class Student
- {
- public string Imie { get; set; }
- public int Wiek { get; set; }
- public float Srednia { get; set; }
- }
Advertisement
Add Comment
Please, Sign In to add comment