public Persoana GasesteInFunctieDeCNP(string cnp) { Persoana p = null; p = (from persoana in listaPersoane where persoana.CNP == cnp select persoana).FirstOrDefault(); return(p); // //var longWords = words.Where(w => w.length > 10); // //string[] words = { "hello", "wonderful", "LINQ", "beautiful", "world" }; ////Get only short words //var shortWords = from word in words // where word.Length <= 5 // select word; ////Print each word out //foreach (var word in shortWords) //{ // Console.WriteLine(word); //} //Console.ReadLine(); }
//private static void AfisareDateColectieStudenti(ColectieStudenti cs) //{ // List<Student> ls = cs.listaColectieStudenti(); // foreach (var item in ls) // { // Console.WriteLine("================="); // Console.WriteLine("CNP student: " + item.CNP); // Console.WriteLine("================="); // } //} private static Persoana CitesteOPersoana() { Persoana pers = new Persoana(); Console.Write("Nume: "); pers.Nume = Console.ReadLine(); Console.Write("Preume: "); pers.Prenume = Console.ReadLine(); Console.Write("Data nasterii: "); pers.DataNasterii = DateTime.Parse(Console.ReadLine()); //dd.mm.yyyy Console.Write("CNP: "); pers.CNP = Console.ReadLine(); return(pers); }
public void Adauga(Persoana p) { listaPersoane.Add(p); }