Public and Internal members in an Internal class?

后端 未结 5 825
暗喜
暗喜 2020-12-25 11:00

Ok, so this may be a bit of a silly question, and there\'s certainly the obvious answer, but I was curious if I\'ve missed any subtleties here.

Is there any differen

5条回答
  •  情书的邮戳
    2020-12-25 11:21

    A public member is still just internal when in an internal class.

    From MSDN:

    The accessibility of a member can never be greater than the accessibility of its containing type. For example, a public method declared in an internal type has only internal accessibility

    Think of it this way, I would access a public property on....? A class I can't see? :)

    Eric's answer is very important in this case, if it's exposed via an interface and not directly it does make a difference, just depends if you're in that situation with the member you're dealing with.

提交回复
热议问题