Access Modifiers in C#
Access Modifiers (Access Specifiers) describes as the scope of accessibility of an Object and its members. All C# types and type members have an accessibility level . We can control the scope of the member object of a class using access specifiers. We are using access modifiers for providing security of our applications. When we specify the accessibility of a type or member we have to declare it by using any of the access modifiers provided by C# language.
C# provide five access specifiers , they are as follows:
1. public: Access is not restricted.
2. protected: Access is limited to the containing class or types derived from the containing class.
3. internal: Access is limited to the current assembly.
4. protected internal: Access is limited to the current assembly or types derived from the containing class.
5. private: Access is limited to the containing type.
Default and allowed access modifiers for members
enum
Default: public
Allowed: None
interface
Default: public
Allowed: None
class
Default: private
Allowed: public, protected, internal, private, protected internal
struct
Default: private
Allowed: public, internal, private
VS 2010 Web Deployment
24 minutes ago

0 comments:
Post a Comment