示例#1
0
        static void doWork()
        {
            int teri = 0;

            Console.WriteLine(teri);
            Pass.Value(teri);
            Console.WriteLine(teri);
            teri = Pass.SetTeri();
            Console.WriteLine(teri);

            Console.WriteLine("---------");

            int i = 0;

            Console.WriteLine($"i is {i}");
            Pass.Value2(ref i);
            Console.WriteLine(i);

            Console.WriteLine("---------");

            WrappedInt wi = new WrappedInt();

            Console.WriteLine(wi.Number);
            Pass.Reference(wi);
            Console.WriteLine(wi.Number);

            Console.WriteLine(wi.IdontKnow);
            Pass.Reference2(wi);
            Console.WriteLine(wi.IdontKnow);

            Console.WriteLine(wi.isTrue);
            Pass.Reference3(wi);
            Console.WriteLine(wi.isTrue);

            Console.ReadKey();

            Duck daffy = new Duck();

            Console.WriteLine($"daffy's name is [{daffy.Name}]");
            daffy.Name = "Daffy";
            Console.WriteLine($"daffy's name is now [{daffy.Name}]");

            Console.ReadKey();
        }