Interface IMethod
- Namespace
- ICSharpCode.Decompiler.TypeSystem
- Assembly
- ICSharpCode.Decompiler.dll
Represents a method, constructor, destructor or operator.
public interface IMethod : IParameterizedMember, IMember, IEntity, ISymbol, ICompilationProvider, INamedElement
- Inherited Members
- Extension Methods
Properties
AccessorKind
Gets the kind of accessor this is.
MethodSemanticsAttributes AccessorKind { get; }
Property Value
AccessorOwner
If this method is an accessor, returns the corresponding property/event. Otherwise, returns null.
IMember? AccessorOwner { get; }
Property Value
HasBody
Gets whether the method has a body.
This property returns false
for abstract
or extern
methods,
or for partial
methods without implementation.
bool HasBody { get; }
Property Value
IsAccessor
Gets whether the method is a property/event accessor.
bool IsAccessor { get; }
Property Value
IsConstructor
bool IsConstructor { get; }
Property Value
IsDestructor
bool IsDestructor { get; }
Property Value
IsExtensionMethod
bool IsExtensionMethod { get; }
Property Value
IsInitOnly
Gets whether this method may only be called on fresh instances.
Used with C# 9 init;
property setters.
bool IsInitOnly { get; }
Property Value
IsLocalFunction
bool IsLocalFunction { get; }
Property Value
IsOperator
bool IsOperator { get; }
Property Value
ReducedFrom
If this method is reduced from an extension method or a local function returns the original method, null
otherwise.
A reduced method doesn't contain the extension method parameter. That means that it has one parameter less than its definition.
A local function doesn't contain compiler-generated method parameters at the end.
IMethod? ReducedFrom { get; }
Property Value
ReturnTypeIsRefReadOnly
Gets whether the return type is 'ref readonly'.
bool ReturnTypeIsRefReadOnly { get; }
Property Value
ThisIsRefReadOnly
Gets whether the method accepts the 'this' reference as ref readonly. This can be either because the method is C# 8.0 'readonly', or because it is within a C# 7.2 'readonly struct'
bool ThisIsRefReadOnly { get; }
Property Value
TypeArguments
Gets the type arguments passed to this method.
If the method is generic but not parameterized yet, this property returns the type parameters,
as if the method was parameterized with its own type arguments (void M<T>() { M<T>(); }
).
IReadOnlyList<IType> TypeArguments { get; }
Property Value
TypeParameters
Gets the type parameters of this method; or an empty list if the method is not generic.
IReadOnlyList<ITypeParameter> TypeParameters { get; }
Property Value
Methods
GetReturnTypeAttributes()
Gets the attributes associated with the return type. (e.g. [return: MarshalAs(...)])
IEnumerable<IAttribute> GetReturnTypeAttributes()
Returns
Remarks
Does not include inherited attributes.
Specialize(TypeParameterSubstitution)
Specializes this method with the given substitution. If this method is already specialized, the new substitution is composed with the existing substition.
IMethod Specialize(TypeParameterSubstitution substitution)
Parameters
substitution
TypeParameterSubstitution