ReflectionUtilities Class
public static class ReflectionUtilitiesNo documentation is available.
Methods
| Name | Description |
|---|---|
| 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)No documentation is available.
GetMethodLocation(MethodInfo)
ReflectionUtilities.csRetrieves 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
methodInfoMethodInfo- 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.csRetrieves 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
methodInfoMethodInfo- 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.