Sunday, November 6, 2016

Default Class Accessibility in C#

Default Class Accessibility in C#

There are two rules for Default Class Accessibility in C# as in the following:

1. Top-level classes, which are not nested in other classes, can only have internal or public accessibility. The default accessibility for these classes is internal.

2. Nested classes, which are members of other classes, can have declared accessibility as indicated in the following table.



Members ofDefault member
accessibility
Allowed declared accessibility
of the member
enumpublicNone
classprivatepublic

 protected

 internal

 private

 protected internal
interfacepublicNone
structprivatepublic

 internal

 private


Ref: Accessibility Levels (C# Reference), msdn.microsoft.com, Nov. 06, 2016.


No comments:

Post a Comment