MemberElement Class

A member of a type: a method, a constructor, a property, a field or an event.

public abstract class MemberElement

Properties

NameDescription
AccessibilityGets the declared accessibility of the member.
AttributesGets the attributes applied to the member.
DeclaringTypeGets the type that declares the member.
DependenciesGets the dependencies of the declaration and the code of the member, including the code of its lambdas and local functions.
IsStaticGets a value indicating whether the member is static.
LocationGets the first statement of the member when the PDB is available, or null.
NameGets the name of the member as written in metadata (.ctor for a constructor).

Accessibility

Gets the declared accessibility of the member.

public abstract ElementAccessibility Accessibility { get; }

Property value

ElementAccessibility

Attributes

Gets the attributes applied to the member.

public abstract IReadOnlyList<AttributeElement> Attributes { get; }

DeclaringType

MemberElement.cs

Gets the type that declares the member.

public TypeElement DeclaringType { get; }

Property value

TypeElement

Dependencies

MemberElement.cs

Gets the dependencies of the declaration and the code of the member, including the code of its lambdas and local functions.

public IReadOnlyList<Dependency> Dependencies { get; }

IsStatic

Gets a value indicating whether the member is static.

public abstract bool IsStatic { get; }

Property value

bool

Location

Gets the first statement of the member when the PDB is available, or null.

public abstract SourceLocation? Location { get; }

Property value

SourceLocation?

Gets the name of the member as written in metadata (.ctor for a constructor).

public string Name { get; }

Property value

string

Methods

NameDescription
HasAttribute(Type)Determines whether the member has an attribute of the given type.
ToString()Returns the member as DeclaringType.Name.

HasAttribute(Type)

MemberElement.cs

Determines whether the member has an attribute of the given type.

public bool HasAttribute(Type attributeType)

Parameters

attributeType Type
The type of the attribute.

Returns

bool true when one of the attributes of the member is of this type.

Returns the member as DeclaringType.Name.

public override string ToString()

Returns

string The member as DeclaringType.Name.