Table of Contents

Interface IMember

Namespace
NDepend.CodeModel
Assembly
NDepend.API.dll

Represents a member code element. This interface is implemented by IMethod, IField and IType.

public interface IMember : IAttributeTarget, ICodeElement, IUsed
Inherited Members
Extension Methods

Properties (21)

CouldBeInternal

Gets a value indicating whether this member is declared as public, but could be declared as internal in C# (Friend in VB.NET) within the context of the analyzed application.

bool CouldBeInternal { get; }

Property Value

bool

Remarks

A public code element can be declared as internal if it is not used outside of the assembly it is declared in.
When analyzing a framework, many of public members will be considered as CouldBeInternal because there is no analyzed client code using them.

CouldBeInternalProtected

Gets a value indicating whether this member is declared as public, but could be declared as protected internal in C# (Protected Friend in VB.NET) within the context of the analyzed application.

bool CouldBeInternalProtected { get; }

Property Value

bool

Remarks

A public member can be declared as protected internal (reads protected or internal) if it is not used outside of the assembly it is declared in and if it is not used outside of the classes that derive from the class it is declared in.
When analyzing a framework, some of the public members will be considered as CouldBeInternalProtected because there is no analyzed client code using them.

CouldBePrivate

Gets a value indicating whether this member could be declared as private in C# (Protected in VB.NET) within the context of the analyzed application.

bool CouldBePrivate { get; }

Property Value

bool

Remarks

A member can be declared as protected if it is not used outside of its parent class.

CouldBeProtected

Gets a value indicating whether this member is declared as public, but could be declared as protected in C# (Protected in VB.NET) within the context of the analyzed application.

bool CouldBeProtected { get; }

Property Value

bool

Remarks

A public member can be declared as protected if it is not used outside of the classes that derive from the class it is declared in.

IsGeneratedByCompiler

Gets a value indicating whether this member has been generated by the compiler. This situation typically results from the compiler implementing lambdas, anonymous methods and iterators.

bool IsGeneratedByCompiler { get; }

Property Value

bool

IsInternal

Gets a value indicating whether this member is declared as internal in C#, or Friend in VB.NET.

bool IsInternal { get; }

Property Value

bool

IsObsolete

Gets a value indicating whether this member is tagged with System.ObsoleteAttribute.

bool IsObsolete { get; }

Property Value

bool

IsPrivate

Gets a value indicating whether this member is declared as private.

bool IsPrivate { get; }

Property Value

bool

IsProtected

Gets a value indicating whether this member is declared as protected.

bool IsProtected { get; }

Property Value

bool

IsProtectedAndInternal

Gets a value indicating whether this member is declared as protected and internal. Since C# 7.2 this visibility level can be used through the two keywords 'private protected'.

bool IsProtectedAndInternal { get; }

Property Value

bool

IsProtectedOrInternal

Gets a value indicating whether this member is declared as protected internal in C#, or Protected Friend in VB.NET.

bool IsProtectedOrInternal { get; }

Property Value

bool

IsPublic

Gets a value indicating whether this member is declared as public.

bool IsPublic { get; }

Property Value

bool

Remarks

See the condition IsPubliclyVisible if you wish to assess if a member is publicly visible outside of its declaring assembly.s

IsPubliclyVisible

Gets a value indicating whether this member is publicly visible outside of its declaring assembly.

bool IsPubliclyVisible { get; }

Property Value

bool

Remarks

Being a publicly visible member is a stronger condition than just having the property getter IsPublic equals to true..
Indeed, it is common that a public member is declared in an internal type, in which case the member is not publicly visible.

IsSpecialName

Gets a value indicating whether this member has a name that requires special handling, in the sense defined by System.Type.IsSpecialName and System.Reflection.MethodBase.IsSpecialName.

bool IsSpecialName { get; }

Property Value

bool

Remarks

Typically methods with special names are constructors, properties/events/indexers accessors, explicit interface method implementation.
Fields with special names is the instance field named value__ generated for each enumeration.

IsStatic

Gets a value indicating whether this member is a static method or field, or a static type.

bool IsStatic { get; }

Property Value

bool

OptimalVisibility

Gets a Visibility value representing the optimal visibility this member could have.

Visibility OptimalVisibility { get; }

Property Value

Visibility
See Also

ParentAssembly

Gets the parent assembly where this member is declared in.

IAssembly ParentAssembly { get; }

Property Value

IAssembly

Remarks

This property getter has a constant time complexity.

ParentNamespace

Gets the parent namespace where this member is declared in.

INamespace ParentNamespace { get; }

Property Value

INamespace

Remarks

This property getter has a constant time complexity.

ParentType

Gets the parent type of this member.

IType ParentType { get; }

Property Value

IType

Remarks

This property getter has a constant time complexity.
If this member is a type not nested in another type, this property returns null.
If this member is an application type nested in another type, this property returns the parent type.
Notice that for third-party nested types, the property IType.IsNested is set to true, but the parent/nested relation is not resolved. Hence for a third-party nested types, null is returned by this property.

ShouldBePublic

Gets a value indicating whether this member is used outside of its declaring assembly thanks to the attribute System.Compilers.Services.InternalsVisibleToAttribute.

bool ShouldBePublic { get; }

Property Value

bool

Remarks

Often, having code elements that are considered as ShouldBePublic is not a problem because it is made on purpose. However, it can be interesting to list them.

Visibility

Gets a Visibility value representing the visibility of this member.

Visibility Visibility { get; }

Property Value

Visibility
See Also