上市
public
关键字使每个消费者都可以使用一个类(包括嵌套类),属性,方法或字段:
public class Foo()
{
public string SomeProperty { get; set; }
public class Baz
{
public int Value { get; set; }
}
}
public class Bar()
{
public Bar()
{
var myInstance = new Foo();
var someValue = foo.SomeProperty;
var myNestedInstance = new Foo.Baz();
var otherValue = myNestedInstance.Value;
}
}