对我来说这是有道理的type declaration is implicitly a static member。
因为如果你有课:
class Foo
{
public class Bar
{
}
}
Run Code Online (Sandbox Code Playgroud)
您无法通过以下方式访问该课程Bar:
Foo f = new Foo();
Bar b =new f.Bar();
Run Code Online (Sandbox Code Playgroud)
(我什至不知道如何写才能使其有意义)。
如果你想访问Bar类,你需要执行以下操作:
Bar b = new Foo.Bar()
Run Code Online (Sandbox Code Playgroud)
您可以通过类而不是实例来访问它。因此
,Bar是 的静态成员Foo。
| 归档时间: |
|
| 查看次数: |
239 次 |
| 最近记录: |