コード例 #1
0
        public static void Run()
        {
            NestedClassA nestedClassA = new NestedClassA();

            Console.WriteLine($"nestedClassA.State = {nestedClassA.State}");

            NestedClassA.NestedClassB nestedClassB = new NestedClassA.NestedClassB();
            nestedClassB.SetPrivateState(nestedClassA, 999);
            Console.WriteLine($"nestedClassA.State = {nestedClassA.State}");
        }
コード例 #2
0
 public void SetPrivateState(NestedClassA target, int newState)
 {
     target.state = newState;
 }