Esempio n. 1
0
        public static void RunTests() {
            const int i = 123456;
            i.DisplayDefiningAssembly();
            var rI = i.ReverseDigits();
            Console.WriteLine("i = {0} was changed to - {1}", i, rI);

            var d = new DataSet();
            d.DisplayDefiningAssembly();

            var sp = new SoundPlayer();
            sp.DisplayDefiningAssembly();

            var list = new List<int> {1,2,3,4};
            list.PrintCollection();
        }
Esempio n. 2
0
    public static void TestMyExtensions()
    {
        // the int has assumed a new identity
        int myInt = 12345678;
        myInt.DisplayDefiningAssembly();

        // so has the DataSet
        System.Data.DataSet d = new System.Data.DataSet();
        d.DisplayDefiningAssembly();

        // and the SoundPlayer
        System.Media.SoundPlayer sp = new System.Media.SoundPlayer();
        sp.DisplayDefiningAssembly();

        // use new integer functionality
        Console.WriteLine("Value of myInt: {0}", myInt);
        Console.WriteLine("Reversed digits of myInt: {0}", myInt.ReverseDigits());
    }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Fun with Extension Methods *****\n");

            int myInt = 12345678;
            myInt.DisplayDefiningAssembly();

            DataSet d = new DataSet();
            d.DisplayDefiningAssembly();

            SoundPlayer sp = new SoundPlayer();
            sp.DisplayDefiningAssembly();

            Console.WriteLine("Value of myInt: {0}", myInt);
            Console.WriteLine("Reversed digits of myInt: {0}", myInt.ReverseDigits());

            myInt.Foo();
            myInt.Foo("Ints that Foo? Who would have thoght it!\n");

            UseCar();

            Console.ReadLine();
        }