Created
May 3, 2024 13:48
-
-
Save Dead-in-side/16837863f1061769ebce8014aee786a4 to your computer and use it in GitHub Desktop.
This file contains 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
namespace IJunior | |
{ | |
public class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
List<Prisoner> prisoners = new List<Prisoner> | |
{ | |
new Prisoner ("Ignat", "Ел мел"), | |
new Prisoner ("Wasyan", "Исполнял"), | |
new Prisoner ("Kalyan", "Воспользовался наличием прав и обязанностей, свобод и запретов, в своих корыстных целях, параллельно убил троих и решил скрыться на детском велосипеде"), | |
new Prisoner ("Igar'", "Антиправительственное"), | |
new Prisoner ("Irtuk", "Антиправительственное"), | |
new Prisoner ("Mishko", "Принимал клиентов. Внутривенно"), | |
}; | |
string amnestyCrime = "Антиправительственное"; | |
ShowPrisoners(prisoners); | |
Console.WriteLine(); | |
var foundPrisoner = prisoners.Where(prisoner => prisoner.Crime == amnestyCrime).Select(prisoner => prisoner); | |
ShowPrisoners(prisoners.Except(foundPrisoner).ToList()); | |
} | |
static void ShowPrisoners(List<Prisoner> prisoners) | |
{ | |
foreach (var prisoner in prisoners) | |
{ | |
prisoner.ShowInfo(); | |
} | |
} | |
} | |
public class Prisoner | |
{ | |
public Prisoner(string name, string crime) | |
{ | |
Name = name; | |
Crime = crime; | |
} | |
public string Name { get; } | |
public string Crime { get; } | |
public void ShowInfo() | |
{ | |
Console.WriteLine(Name + " - " + Crime); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment