What are the Default Access Modifiers in C#?

Access Modifiers

Access Modifiers in C# allow you to control access to the class and to restrict the ability of the class to be instantiated or to serve as the base of another class. The class modifiers are public, protected, internal, private, abstract, sealed, and new.

All types and type members have an accessibility level, which controls whether they can be used from other code in your assembly or other assemblies. You can use the following access modifiers to specify the accessibility of a type or member when you declare it:

Default Access Modifiers in C#


The type or member can be accessed by any other code in the same assembly or another assembly that references it.


The type or member can be accessed by any code in the same assembly, but not from another assembly.

Class and Struct Accessibility

Internal is the default if no access modifier is specified.

Class and Struct Member Accessibility

Class members (including nested classes and structs) can be declared with any of the five types of access. Struct members cannot be declared as protected because structs do not support inheritance.

Other Types

Interfaces declared directly with a namespace can be declared as public or internal and like classes and structs, interfaces default to internal access.

Enumeration members are always public, and no access modifiers can be applied.

By default, delegates have internal access.
 (C) 2022    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About