示例#1
0
        static void Main(string[] args)
        {
            IndexerSample s = new IndexerSample();

            Console.WriteLine(s[2]);
            Console.ReadLine();
        }
示例#2
0
        private static void Week4FundamentalsReview()
        {
            //Fundamentals

            /*
             * example of calling a static class and its static method, noting
             * that we do not need to instantiate an instance of the class to use it
             */
            Console.WriteLine(Utility.AddTwoNumbers(7, 6));


            //the square has access to the abstract class Shape's properties (ie: square.Sides)
            Square square = new Square(5, 5);

            square.Sides = 100;
            Console.WriteLine(square.Area());


            //Generics example
            Dinosaur dino1G = new Dinosaur();
            Dinosaur dino2G = new Dinosaur();
            Dinosaur dino3G = new Dinosaur();
            TRex     tRexG  = new TRex();
            GenericsList <Dinosaur> dinoList = new GenericsList <Dinosaur>();

            dinoList.Add(dino1G);
            dinoList.Add(dino2G);
            dinoList.Add(dino3G);
            dinoList.Add(tRexG);


            //Indexers
            IndexerSample indexSample = new IndexerSample();

            for (int i = 0; i < indexSample.Length; i++)
            {
                Console.WriteLine(indexSample[i]);
            }
        }
示例#3
0
        public void TestIndexerPropertiesAreNotDeserialized()
        {
            object obj = IndexerSample.GetSampleInstance();

            PerformTest(obj);
        }