Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
C#。为什么可以访问私有字段?
internal class MyClass { private int someInt; public static StaticMethod() { new MyClass().someInt = 3; } }
同一类的所有实例都可以访问它。
可访问性是针对类的,而不是针对每个实例的。