Esempio n. 1
0
 //Totally unnecessary (use a ToString() override)
 static void PrintPerson(Person p)
 {
     Console.WriteLine(p.Name
         + "("+ p.Gender + ", " + p.Age + ")"
         + ": " + p.Hair + ", " + p.Eyes +  " : "
         + p.Mass + "kg, " + p.Height + "cm");
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Person Daenarys = new Person();
            Daenarys.Name = "Daenarys Targaryen";
            Daenarys.Age = 22;
            Daenarys.Mass = 54;
            Daenarys.Height = 152;
            Daenarys.Hair = Color.WhiteSmoke;
            Daenarys.Eyes = EyeColour.Lavender;
            PrintPerson(Daenarys);
            //Console.WriteLine(Daenarys);

            //Vector (VECTOR, DARNIT) of int
            List<int> VictorTheVector = new List<int>(10);
            VictorTheVector.Add(12);
            VictorTheVector.Insert(0, 15);
            PrintTheVector(VictorTheVector);

            //List (YES, LIST)
            LinkedList<int> Ella = new LinkedList<int>(VictorTheVector);
            

            Ella.AddFirst(0);
            foreach (int i in Ella) Console.Write(i + ", ");
            Console.WriteLine();

            LinkedListNode<int> Current = Ella.First;
            while (Current.Next != null)
                Current = Current.Next;
            Console.WriteLine("Value of last node is " + Current.Value);

            VictorTheVector.Sort();
            PrintTheVector(VictorTheVector);



            Console.ReadKey();
        }