Exemplo n.º 1
0
 public static void AterarCor(Carro c)
 {
     c.cor = Console.ReadLine();
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            // C# Essential Training



            // Up and Running with C#
            Stack myStack = new Stack();

            myStack.Push("String");
            myStack.Push(34);
            myStack.Push(myStack);
            myStack.Pop();

            SortedList <string, string> sortedListD = new SortedList <string, string>();

            sortedListD.Add("Dan", "IsGreat");
            sortedListD.Add("He", "IsGreatest");
            sortedListD.Add("I", "IsGreatester");

            Console.WriteLine(sortedListD);

            Stack <string> strStack = new Stack <string>();

            strStack.Push("A String");

            int    intValue = 32;
            object objValue = intValue;
            string strValue;

            string errorMessage;

            try
            {
                strValue = (string)objValue;
            }
            catch (InvalidCastException dErp)
            {
                errorMessage = dErp.Message;
                Console.WriteLine(errorMessage);
            }


            Carro VW = new Carro();

            VW.Drive();
            VW.Stopping();

            Animul newAnimul = new Animul();

            newAnimul.move();

            Animul Dog = new Animul();

            Dog.Age   = 3;
            Dog.Color = "Blue";
            Console.WriteLine(Dog.Age);
            Console.WriteLine(Dog.Color);
            Sum(1, 2);

            Doge Nixon = new Doge();

            Nixon.move();

            Nixon.move();
            Nixon.makeNoise();


            Console.WriteLine(Concatenate2("test ", "me"));
            Concatenate("Test, ", "again");

            for (int counter = 0; counter < 11; counter++)
            {
                Console.WriteLine(counter);
            }
        }
Exemplo n.º 3
0
 public static void AterarModelo(Carro c)
 {
     c.km = Double.Parse(Console.ReadLine());
 }