예제 #1
0
 public void TestInnerWithOuterInstance()
 {
     Outer outer = new Outer();
     Outer.Inner inner = new Outer.Inner(outer);
 }
예제 #2
0
            /// <summary>Initializes a new instance of the <see cref="Inner"/> class.</summary>
            /// <param name="outer">The outer.</param>
            public Inner(Outer outer)
            {
                Console.WriteLine("Class Inner");
                Console.WriteLine("Can access non-static fields by using Instance object");
                Console.WriteLine("a " + outer.a);
                Console.WriteLine("b " + outer.b);
                Console.WriteLine("c " + outer.c);
                Console.WriteLine("d " + outer.d);
                Console.WriteLine("e " + e);

                StaticMethod();
                Console.WriteLine("Can access non-static fields by using Instance object");
                outer.InstanceMethod();
            }