Public - Access not limited. The type or member can be accessed by any other code in the same assembly or another assembly that references it.
Private - Access limited to the containing class.The type or member can only be accessed by code in the same class or struct.
Protected - Access limited to the containing class and to the types derived from the containing class. The type or member can only be accessed by code in the same class or struct, or in a derived class.
Internal - Access limited to this- program or assembly.The type or member can be accessed by any code in the same assembly, but not from another assembly.
Protected Internal - Access limited to the containing class, derived classes members or assembly.The type or member can be accessed by any code in the same assembly, or by any derived class in another assembly.
This group is an initiative from "Vidya Vrat Agarwal" a .NET Passionate. This group is created with a vision to encourage and help people learn Microsoft .NET technology. This group also provides a platform to share ideas, thoughts and experiences an individual may have while learning and implementing .NET technologies.
2 comments:
C# supports following access modifiers:
Public - Access not limited. The type or member can be accessed by any other code in the same assembly or another assembly that references it.
Private - Access limited to the containing class.The type or member can only be accessed by code in the same class or struct.
Protected - Access limited to the containing class and to the types derived from the containing class. The type or member can only be accessed by code in the same class or struct, or in a derived class.
Internal - Access limited to this- program or assembly.The type or member can be accessed by any code in the same assembly, but not from another assembly.
Protected Internal - Access limited to the containing class, derived classes members or assembly.The type or member can be accessed by any code in the same assembly, or by any derived class in another assembly.
C# supports
Public
private
protected
Internal
Default is Internal(which is throughout the assembly) at class level
Default is private for all methods and variables.
Post a Comment