public static void InitEresource(int size, List <Eresource> eresources, Random rnd) { for (int i = 0; i < size; i++) { Eresource eresource = new Eresource(); eresource.Autor = string.Format("{0}", rnd.Next(1, 200)); eresource.Ename = string.Format("{0}", rnd.Next(1, 1000)); eresource.Linq = string.Format("{0}", rnd.Next(100, 10000)); eresource.Anotation = string.Format("{0}", rnd.Next(1, 10000)); eresources.Add(eresource); } }
public static void FindResource(List <Eresource> eresources, string userIn) { Eresource obj = eresources.Find(w => w.Autor == userIn); if (obj != null) { Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; obj.PrintInfo(); } else { Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Автор не найден"); Console.WriteLine(); } Console.ResetColor(); }