Access Modifiers in ASP.Net C# Programming

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 specify the accessibility of a type or member when you declare it by using one of these access modifiers:

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

private
The type or member can only be accessed by code in the same class or struct.

protected
The type or member can only be accessed by code in the same class or struct, or in a derived class.

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

protected internal
The type or member can be accessed by any code in the same assembly, or by any derived class in another assembly.
Tags: , , ,
Hot on Web:


About author