内部与私有访问修饰符修饰符

2023-09-02 20:45:08 作者:娇而不傲

之间的区别是什么内部私人在C#中的访问修饰符?

What is the difference between the internal and private access modifiers in C#?

推荐答案

内部是组装范围(由code在同一个.exe文件即只访问或.dll)

internal is for assembly scope (i.e. only accessible from code in the same .exe or .dll)

私人是类范围(即只从同一类code访问)。

private is for class scope (i.e. accessible only from code in the same class).

相关推荐