-
Об'єднання команд і гравців (Join)
Завдання: Уяви базу даних футбольних команд. У тебе є дві колекції: команди з ID та назвою; гравці з ID команди, ім'ям та голами. Використовуй Join для об'єднання, щоб отримати список гравців з назвою їхньої команди, фільтруй гравців з >10 голами, сортуй за голами (за спаданням) і спроектуй у тип {Команда, Гравець, Голи}.
Дані: 3 команди (Динамо Київ, Шахтар Донецьк, Металіст Харків); 5 гравців з голами.
Очікуваний результат: Список з 3 гравцями, наприклад: Шахтар Донецьк: Михайло Коваленко (20 голів). -
Множинні операції з наборами пісень (Union/Intersect/Except)
Завдання: У тебе є дві колекції пісень: рок з назвами та роками; поп з назвами та роками. Використовуй Union для всіх унікальних пісень, Intersect для спільних (кросовери), Except для рок-пісень, яких немає в поп. Спроектуй у {Назва, Рік}, сортуй за роком (за зростанням).
Дані: Рок: Stairway to Heaven (1971), Bohemian Rhapsody (1975), Smells Like Teen Spirit (1991); Поп: Bohemi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Text; | |
| using System.Reflection; | |
| namespace Attributes | |
| { | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| Console.OutputEncoding = Encoding.UTF8; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Linq; | |
| using System.Text; | |
| public class Creature | |
| { | |
| public string Name { get; set; } // назва істоти | |
| public bool Flying { get; set; } // літає? | |
| public bool Ranged { get; set; } // стріляє на відстані? | |
| public int Attack { get; set; } // атака | |
| public int Defense { get; set; } // захист |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Linq; | |
| using System.Text; | |
| using System.Xml.Linq; | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| Console.OutputEncoding = Encoding.UTF8; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Linq; | |
| using System.Text; | |
| public class Book | |
| { | |
| public string Title { get; set; } | |
| public string Author { get; set; } | |
| public string Genre { get; set; } | |
| public double Rating { get; set; } | |
| public int ReviewsCount { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Linq; | |
| using System.Text; | |
| public class DJ | |
| { | |
| public string Name { get; set; } | |
| public int Rank { get; set; } | |
| public string Genre { get; set; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Linq; | |
| using System.Text; | |
| public class Product | |
| { | |
| public string Name { get; set; } | |
| public decimal Price { get; set; } | |
| public string Category { get; set; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Linq; | |
| using System.Text; | |
| public class Student | |
| { | |
| public string Name { get; set; } | |
| public int Age { get; set; } | |
| } | |
| class Program |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.ComponentModel.DataAnnotations; | |
| using System.ComponentModel.DataAnnotations.Schema; | |
| using System.Text.Json.Serialization; | |
| /// <summary> | |
| /// Клас, що представляє студента. | |
| /// </summary> | |
| /// | |
| /// <remarks> | |
| /// Цей клас містить інформацію про студента, таку як ім'я, електронну пошту та ідентифікатор. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Reflection; | |
| using System.Text; | |
| using System.Xml; | |
| class Program | |
| { | |
| private static readonly string carsXml = @"<?xml version='1.0' encoding='utf-8'?> | |
| <Cars> | |
| <Car Image='ford.jpg'> | |
| <Manufactured>Ford Motor Co.</Manufactured> |