What are the default access modifiers in C#?

后端 未结 9 1561
暖寄归人
暖寄归人 2020-11-22 03:44

What is the default access modifier for classes, methods, members, constructors, delegates and interfaces?

9条回答
  •  失恋的感觉
    2020-11-22 03:48

    top level class: internal
    method: private
    members (unless an interface or enum): private (including nested classes)
    members (of interface or enum): public
    constructor: private (note that if no constructor is explicitly defined, a public default constructor will be automatically defined)
    delegate: internal
    interface: internal
    explicitly implemented interface member: public!
    

提交回复
热议问题