ReflectionUtilities Class

public static class ReflectionUtilities

No documentation is available.

Methods

NameDescription
GetImplicitConversion(object?, Type)
GetMethodLocation(MethodInfo)Retrieves the source file path and the first sequence point for the specified method using portable PDB information if available.
GetMethodLocationAsync(MethodInfo)Retrieves the source file path and the first sequence point for the specified method using portable PDB information if available.
IsFlagsEnum(Type)
IsFlagsEnum<T>()
IsNullableOfT(Type)

GetImplicitConversion(object?, Type)

ReflectionUtilities.cs
[RequiresUnreferencedCode("Use reflection to find static methods")]
public static MethodInfo? GetImplicitConversion(object? value, Type targetType)

Parameters

value object?
targetType Type

Returns

MethodInfo?

No documentation is available.

GetMethodLocation(MethodInfo)

ReflectionUtilities.cs

Retrieves the source file path and the first sequence point for the specified method using portable PDB information if available.

public static (string FilePath, SequencePoint SequencePoint)? GetMethodLocation(this MethodInfo methodInfo)

Parameters

methodInfo MethodInfo
The reflection metadata for the method whose source location is to be determined.

Returns

(string FilePath, SequencePoint SequencePoint)? A tuple containing the source file path and the first sequence point for the method, or null if the assembly location is unavailable.

Remarks

This method requires that the target assembly has an accessible portable PDBs (embedded or next to the dll). If the method or its assembly does not meet this requirement, an exception is thrown. The returned sequence point typically corresponds to the first executable line of the method in the source file.

GetMethodLocationAsync(MethodInfo)

ReflectionUtilities.cs

Retrieves the source file path and the first sequence point for the specified method using portable PDB information if available.

net10.0

public static Task<(string FilePath, SequencePoint SequencePoint)?> GetMethodLocationAsync(this MethodInfo methodInfo)

net11.0

public static Task<(string FilePath, SequencePoint SequencePoint)?> GetMethodLocationAsync(this MethodInfo methodInfo)

Parameters

methodInfo MethodInfo
The reflection metadata for the method whose source location is to be determined.

Returns

Task<(string FilePath, SequencePoint SequencePoint)?> A tuple containing the source file path and the first sequence point for the method, or null if the assembly location is unavailable.

Remarks

This method requires that the target assembly has an accessible portable PDBs (embedded or next to the dll). If the method or its assembly does not meet this requirement, an exception is thrown. The returned sequence point typically corresponds to the first executable line of the method in the source file.

IsFlagsEnum overloads

IsFlagsEnum(Type)

ReflectionUtilities.cs
public static bool IsFlagsEnum(this Type type)
Parameters
type Type
Returns

bool

No documentation is available.

IsFlagsEnum<T>()

ReflectionUtilities.cs
public static bool IsFlagsEnum<T>()
Type parameters
T
Returns

bool

No documentation is available.

IsNullableOfT(Type)

ReflectionUtilities.cs
public static bool IsNullableOfT(this Type type)

Parameters

type Type

Returns

bool

No documentation is available.