Open sandboxFocus

Method GetSymbol

GetSymbol(ICompilationElement, bool)

Gets the Roslyn ISymbol for a Metalama declaration.

Declaration
public static ISymbol? GetSymbol(this ICompilationElement declaration, bool returnNullIfMappingRequired = true)
Parameters
Type Name Description
ICompilationElement declaration

The Metalama declaration.

bool returnNullIfMappingRequired

If true, returns null when the symbol requires generic context mapping; if false, throws ArgumentOutOfRangeException.

Returns
Type Description
ISymbol

The Roslyn symbol, or null if not symbol-backed or mapping is required.

GetSymbol(IRef, Compilation, bool)

Declaration
public static ISymbol? GetSymbol(this IRef declaration, Compilation compilation, bool ignoreAssemblyKey = false)
Parameters
Type Name Description
IRef declaration
Compilation compilation
bool ignoreAssemblyKey
Returns
Type Description
ISymbol

GetSymbol(IType, bool)

Gets the Roslyn ITypeSymbol for a Metalama IType.

Declaration
public static ITypeSymbol? GetSymbol(this IType type, bool returnNullIfMappingRequired = true)
Parameters
Type Name Description
IType type

The Metalama type.

bool returnNullIfMappingRequired

If true, returns null when the symbol requires generic context mapping.

Returns
Type Description
ITypeSymbol

The Roslyn type symbol, or null if not available.

GetSymbol(INamedType, bool)

Gets the Roslyn INamedTypeSymbol for a Metalama INamedType.

Declaration
public static INamedTypeSymbol? GetSymbol(this INamedType namedType, bool returnNullIfMappingRequired = true)
Parameters
Type Name Description
INamedType namedType

The Metalama named type.

bool returnNullIfMappingRequired

If true, returns null when the symbol requires generic context mapping.

Returns
Type Description
INamedTypeSymbol

The Roslyn named type symbol, or null if not available.

GetSymbol(ITypeParameter, bool)

Gets the Roslyn ITypeParameterSymbol for a Metalama ITypeParameter.

Declaration
public static ITypeParameterSymbol? GetSymbol(this ITypeParameter typeParameter, bool returnNullIfMappingRequired = true)
Parameters
Type Name Description
ITypeParameter typeParameter

The Metalama type parameter.

bool returnNullIfMappingRequired

If true, returns null when the symbol requires generic context mapping.

Returns
Type Description
ITypeParameterSymbol

The Roslyn type parameter symbol, or null if not available.

GetSymbol(IMethodBase, bool)

Gets the Roslyn IMethodSymbol for a Metalama IMethodBase (method or constructor).

Declaration
public static IMethodSymbol? GetSymbol(this IMethodBase method, bool returnNullIfMappingRequired = true)
Parameters
Type Name Description
IMethodBase method

The Metalama method or constructor.

bool returnNullIfMappingRequired

If true, returns null when the symbol requires generic context mapping.

Returns
Type Description
IMethodSymbol

The Roslyn method symbol, or null if not available.

GetSymbol(IProperty, bool)

Gets the Roslyn IPropertySymbol for a Metalama IProperty.

Declaration
public static IPropertySymbol? GetSymbol(this IProperty property, bool returnNullIfMappingRequired = true)
Parameters
Type Name Description
IProperty property

The Metalama property.

bool returnNullIfMappingRequired

If true, returns null when the symbol requires generic context mapping.

Returns
Type Description
IPropertySymbol

The Roslyn property symbol, or null if not available.

GetSymbol(IEvent, bool)

Gets the Roslyn IEventSymbol for a Metalama IEvent.

Declaration
public static IEventSymbol? GetSymbol(this IEvent @event, bool returnNullIfMappingRequired = true)
Parameters
Type Name Description
IEvent event

The Metalama event.

bool returnNullIfMappingRequired

If true, returns null when the symbol requires generic context mapping.

Returns
Type Description
IEventSymbol

The Roslyn event symbol, or null if not available.

GetSymbol(IField, bool)

Gets the Roslyn IFieldSymbol for a Metalama IField.

Declaration
public static IFieldSymbol? GetSymbol(this IField field, bool returnNullIfMappingRequired = true)
Parameters
Type Name Description
IField field

The Metalama field.

bool returnNullIfMappingRequired

If true, returns null when the symbol requires generic context mapping.

Returns
Type Description
IFieldSymbol

The Roslyn field symbol, or null if not available.

GetSymbol(IParameter, bool)

Gets the Roslyn IParameterSymbol for a Metalama IParameter.

Declaration
public static IParameterSymbol? GetSymbol(this IParameter parameter, bool returnNullIfMappingRequired = true)
Parameters
Type Name Description
IParameter parameter

The Metalama parameter.

bool returnNullIfMappingRequired

If true, returns null when the symbol requires generic context mapping.

Returns
Type Description
IParameterSymbol

The Roslyn parameter symbol, or null if not available.

GetSymbol(IAssembly, bool)

Gets the Roslyn IAssemblySymbol for a Metalama IAssembly.

Declaration
public static IAssemblySymbol GetSymbol(this IAssembly assembly, bool returnNullIfMappingRequired = true)
Parameters
Type Name Description
IAssembly assembly

The Metalama assembly.

bool returnNullIfMappingRequired

If true, returns null when the symbol requires generic context mapping.

Returns
Type Description
IAssemblySymbol

The Roslyn assembly symbol.