且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

内部类和外部类在C#

更新时间:2023-02-08 09:29:32

没有,C#不具备在这种情况下,相同的语义的Java。你可以让 TestVariable 常量静态,或通的实例内蒙古构造因为你已经注意到。

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.