MethodSymbolExtensions Class

internal static class MethodSymbolExtensions

No documentation is available.

Methods

NameDescription
GetImplementedInterfaceMember(IEventSymbol)
GetImplementedInterfaceMember(IMethodSymbol)
GetImplementedInterfaceMember(IPropertySymbol)
GetReturnTypeAttribute(IMethodSymbol, ITypeSymbol?, bool)Gets the first return type attribute of method that matches attributeType. Only the attributes applied to the return type of method are considered. Unlike Attribute.GetCustomAttributes(inherit: true), the methods overridden by method are never inspected.
HasReturnTypeAttribute(IMethodSymbol, ITypeSymbol?, bool)Indicates whether the return type of method has an attribute matching attributeType. Only the attributes applied to the return type of method are considered. Unlike Attribute.GetCustomAttributes(inherit: true), the methods overridden by method are never inspected.
IsInterfaceImplementation(IEventSymbol)
IsInterfaceImplementation(IMethodSymbol)
IsInterfaceImplementation(IPropertySymbol)
IsOrOverrides(IMethodSymbol?, IMethodSymbol?)
IsPrimaryConstructor(IMethodSymbol?, CancellationToken, bool)
Overrides(IMethodSymbol?, ISymbol?)

GetImplementedInterfaceMember overloads

GetImplementedInterfaceMember(IEventSymbol)

public static IEventSymbol? GetImplementedInterfaceMember(this IEventSymbol symbol)
Parameters
symbol IEventSymbol
Returns

IEventSymbol?

No documentation is available.

GetImplementedInterfaceMember(IMethodSymbol)

public static IMethodSymbol? GetImplementedInterfaceMember(this IMethodSymbol symbol)
Parameters
symbol IMethodSymbol
Returns

IMethodSymbol?

No documentation is available.

GetImplementedInterfaceMember(IPropertySymbol)

public static IPropertySymbol? GetImplementedInterfaceMember(this IPropertySymbol symbol)
Parameters
symbol IPropertySymbol
Returns

IPropertySymbol?

No documentation is available.

GetReturnTypeAttribute(IMethodSymbol, ITypeSymbol?, bool)

Gets the first return type attribute of method that matches attributeType. Only the attributes applied to the return type of method are considered. Unlike Attribute.GetCustomAttributes(inherit: true), the methods overridden by method are never inspected.

public static AttributeData? GetReturnTypeAttribute(this IMethodSymbol method, ITypeSymbol? attributeType, bool inherits = true)

Parameters

method IMethodSymbol
The method whose return type attributes are inspected.
attributeType ITypeSymbol?
The type of the attribute to look for. When null, no attribute is returned.
inherits bool
When true, an attribute also matches when its class derives from attributeType. When false, the attribute class must be exactly attributeType. This parameter is ignored when attributeType is sealed, as no other class can derive from it. Note this is unrelated to the inherit parameter of Attribute.GetCustomAttributes: it never makes the methods overridden by method be inspected.

Returns

AttributeData? The first matching attribute, or null when the return type of method has no matching attribute.

HasReturnTypeAttribute(IMethodSymbol, ITypeSymbol?, bool)

Indicates whether the return type of method has an attribute matching attributeType. Only the attributes applied to the return type of method are considered. Unlike Attribute.GetCustomAttributes(inherit: true), the methods overridden by method are never inspected.

public static bool HasReturnTypeAttribute(this IMethodSymbol method, ITypeSymbol? attributeType, bool inherits = true)

Parameters

method IMethodSymbol
The method whose return type attributes are inspected.
attributeType ITypeSymbol?
The type of the attribute to look for. When null, the method returns false.
inherits bool
When true, an attribute also matches when its class derives from attributeType. When false, the attribute class must be exactly attributeType. This parameter is ignored when attributeType is sealed, as no other class can derive from it. Note this is unrelated to the inherit parameter of Attribute.GetCustomAttributes: it never makes the methods overridden by method be inspected.

Returns

bool true when the return type of method has a matching attribute; otherwise false.

IsInterfaceImplementation overloads

IsInterfaceImplementation(IEventSymbol)

public static bool IsInterfaceImplementation(this IEventSymbol symbol)
Parameters
symbol IEventSymbol
Returns

bool

No documentation is available.

IsInterfaceImplementation(IMethodSymbol)

public static bool IsInterfaceImplementation(this IMethodSymbol symbol)
Parameters
symbol IMethodSymbol
Returns

bool

No documentation is available.

IsInterfaceImplementation(IPropertySymbol)

public static bool IsInterfaceImplementation(this IPropertySymbol symbol)
Parameters
symbol IPropertySymbol
Returns

bool

No documentation is available.

IsOrOverrides(IMethodSymbol?, IMethodSymbol?)

public static bool IsOrOverrides(this IMethodSymbol? symbol, IMethodSymbol? baseMethod)

Parameters

symbol IMethodSymbol?
baseMethod IMethodSymbol?

Returns

bool

No documentation is available.

IsPrimaryConstructor(IMethodSymbol?, CancellationToken, bool)

public static bool IsPrimaryConstructor(this IMethodSymbol? methodSymbol, CancellationToken cancellationToken, bool includeRecordDeclarations = false)

Parameters

methodSymbol IMethodSymbol?
cancellationToken CancellationToken
includeRecordDeclarations bool

Returns

bool

No documentation is available.

Overrides(IMethodSymbol?, ISymbol?)

public static bool Overrides(this IMethodSymbol? symbol, ISymbol? baseSymbol)

Parameters

symbol IMethodSymbol?
baseSymbol ISymbol?

Returns

bool

No documentation is available.