Tag Archives: Access modifier

Access Modifiers in C#

In C# there are 5 different types of Access Modifiers.

Modifier Description
public There are no restrictions on accessing public members.
private Access is limited to within the class definition. This is the default access modifier type if none is formally specified
protected Access is limited to within the class definition and any class that inherits from the class
internal Access is limited exclusively to classes defined within the current project assembly
protected internal Access is limited to the current assembly and types derived from the containing class. All members in current project and all members in derived class can access the variables.


An enum has default modifier as public.

class has default modifiers as Internal.

An interface has default modifier as public.

struct has default modifier as Internal.

methods, fields, and properties has default access modifier as “Private” if no modifier is specified.

Access modifiers

Leave a comment

Filed under C#