MethodElement Class

A method, a constructor, or the accessor of a property or an event.

public sealed class MethodElement : MemberElement
Inheritance
MemberElement MethodElement

Properties

NameDescription
AccessibilityGets the declared accessibility of the member.
AttributesGets the attributes applied to the member.
GenericParametersGets the names of the generic parameters of the method.
IsAbstractGets a value indicating whether the method is abstract, including the methods of an interface that have no default implementation.
IsAsyncGets a value indicating whether the method is async.
IsConstructorGets a value indicating whether the method is an instance or a static constructor.
IsExtensionGets a value indicating whether the method is an extension method.
IsStaticGets a value indicating whether the member is static.
IsVirtualGets a value indicating whether the method can be overridden: it is virtual or abstract, and not sealed.
LocationGets the first statement of the member when the PDB is available, or null.
ParametersGets the parameters of the method.
ReturnTypeGets the return type of the method (System.Void when it returns nothing).

Accessibility

MethodElement.cs

Gets the declared accessibility of the member.

public override ElementAccessibility Accessibility { get; }

Property value

ElementAccessibility

Gets the attributes applied to the member.

public override IReadOnlyList<AttributeElement> Attributes { get; }

GenericParameters

MethodElement.cs

Gets the names of the generic parameters of the method.

public IReadOnlyList<string> GenericParameters { get; }

Property value

IReadOnlyList<string>

Gets a value indicating whether the method is abstract, including the methods of an interface that have no default implementation.

public bool IsAbstract { get; }

Property value

bool

Gets a value indicating whether the method is async.

public bool IsAsync { get; }

Property value

bool

IsConstructor

MethodElement.cs

Gets a value indicating whether the method is an instance or a static constructor.

public bool IsConstructor { get; }

Property value

bool

IsExtension

MethodElement.cs

Gets a value indicating whether the method is an extension method.

public bool IsExtension { get; }

Property value

bool

Gets a value indicating whether the member is static.

public override bool IsStatic { get; }

Property value

bool

Gets a value indicating whether the method can be overridden: it is virtual or abstract, and not sealed.

public bool IsVirtual { get; }

Property value

bool

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

public override SourceLocation? Location { get; }

Property value

SourceLocation?

Gets the parameters of the method.

public IReadOnlyList<ParameterElement> Parameters { get; }

Gets the return type of the method (System.Void when it returns nothing).

public TypeReference ReturnType { get; }

Property value

TypeReference

Methods

NameDescription
ToString()Returns the method as DeclaringType.Name(ParameterTypes).

Returns the method as DeclaringType.Name(ParameterTypes).

public override string ToString()

Returns

string The method as DeclaringType.Name(ParameterTypes).