Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        //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);
        }
Exemplo n.º 3
0
 public void Adauga(Persoana p)
 {
     listaPersoane.Add(p);
 }