Inner class and Outer class in c#

前端 未结 4 1995
天命终不由人
天命终不由人 2021-01-05 19:25

how to implement inner outer classes in c#

i have two nested classes

like

class Outer
{
    int TestVariable = 0;
    class Inner
    {
              


        
4条回答
  •  [愿得一人]
    2021-01-05 20:08

    No, C# does not have the same semantics as Java in this case. You can either make TestVariable const, static, or pass an instance of Outer to the constructor of Inner as you already noted.

提交回复
热议问题