Member nodes such as data types, fields, properties, methods, and
events have access modifiers associated with them. These define the level
of object-oriented encapsulation implemented by the member. The
introspection API provides properties to determine which access modifier
is applied. You are familiar with these; however each .NET language has
slightly different names for the modifiers. The following table shows you
how to convert between the language-specific modifiers and the properties
provided by Member nodes.
Table 1. Access Modifiers
| Introspection Property | C# | VB.NET | C++/CLI |
|---|---|---|---|
IsPublic | public | Public | public |
IsFamilyOrAssembly | protected internal | Protected Friend | public protected |
IsFamily | protected | Protected | protected |
IsFamilyAndAssembly | n/a | n/a | protected private |
IsAssembly | internal | Friend | internal |
IsPrivate | private | Private | private |
![]() | Important |
|---|---|
|
On any member node, exactly one of these properties is
|
Sometimes, instead of using the above properties, you only care
whether or not the member is ultimately exposed for use outside the
assembly. You may want to enforce stricter
FxCop rules for the members that constitute
your published API versus members that are just internal implementation
details. Introspection considers such members "externally visible" and
provides the IsVisibleOutsideAssembly property.
For example, a public method in a public class
is considered externally visible as is a protected method in
a public class. However, a public method in a
private class is not externally visible.