Tuesday, March 16, 2010

Access Levels

Access levels
Access Level            Description
public                Used with types and members. Access is not restricted.
private            Used with members. Access is permitted only through member
            methods of the same class.
protectd            Used with members. Access is permitted through member methods of
            the same class or a derived class.
internal            Used with types and members. Access is permitted through methods in
            the same assembly.
protected internal        Used with members. Access is permitted through member methods of
            the class or a derived class, in addition to the methods in the same
            assembly.
The following talbe shows the default access levels and the allowed access levels to use with different
type members.
Access levels of type members:
MemberOf        Default Access Level            Allowed Access Levels
enum            public                    n/a
class            private                    public
                                protected
                                internal
                                private
                                protectd internal
interface        public                    n/a
struct            private                    public
                                internal
                                private
Note: -  1)  There are no access levels for namespaces.
2) For classes nested inside other classes,  the default access level is internal. The allowed access levels ae public or internal.

No comments:

Post a Comment