Class LocatorExtensions
- Namespace
- AsmLocator
- Assembly
- AsmLocator.dll
Provides lookup operations directly on AsmResolver objects without creating an AssemblyLocator.
For example: typeDef.FindMethod(MethodSpec.ByName("Execute")).
public static class LocatorExtensions
- Inheritance
-
LocatorExtensions
- Inherited Members
Methods
FindEvent(TypeDefinition, EventSpec)
Returns the first event declared on this type that satisfies the specification, or null.
public static EventDefinition? FindEvent(this TypeDefinition type, EventSpec spec)
Parameters
typeTypeDefinitionThe AsmResolver type definition on which the extension method operates.
specEventSpecThe specification that candidate objects must satisfy.
Returns
- EventDefinition
The first match, or null when nothing matches.
FindEvents(TypeDefinition, EventSpec)
Enumerates events declared directly on this type that satisfy the supplied event specification.
public static IEnumerable<EventDefinition> FindEvents(this TypeDefinition type, EventSpec spec)
Parameters
typeTypeDefinitionThe AsmResolver type definition on which the extension method operates.
specEventSpecThe specification that candidate objects must satisfy.
Returns
- IEnumerable<EventDefinition>
A lazily evaluated sequence of the matching items; empty when nothing matches.
FindField(TypeDefinition, FieldSpec)
Returns the first field declared on this type that satisfies the specification, or null.
public static FieldDefinition? FindField(this TypeDefinition type, FieldSpec spec)
Parameters
typeTypeDefinitionThe AsmResolver type definition on which the extension method operates.
specFieldSpecThe specification that candidate objects must satisfy.
Returns
- FieldDefinition
The first match, or null when nothing matches.
FindFields(TypeDefinition, FieldSpec)
Enumerates fields declared directly on this type that satisfy the supplied field specification.
public static IEnumerable<FieldDefinition> FindFields(this TypeDefinition type, FieldSpec spec)
Parameters
typeTypeDefinitionThe AsmResolver type definition on which the extension method operates.
specFieldSpecThe specification that candidate objects must satisfy.
Returns
- IEnumerable<FieldDefinition>
A lazily evaluated sequence of the matching items; empty when nothing matches.
FindInstructions(CilMethodBody, InstructionSpec)
Enumerates matching instructions in this method body and includes each instruction's current index.
public static IEnumerable<InstructionMatch> FindInstructions(this CilMethodBody body, InstructionSpec spec)
Parameters
bodyCilMethodBodyThe CIL method body containing the local variables or instructions to search.
specInstructionSpecThe specification that candidate objects must satisfy.
Returns
- IEnumerable<InstructionMatch>
A lazily evaluated sequence of the matching items; empty when nothing matches.
FindLocals(CilMethodBody, LocalSpec)
Enumerates local variables in this method body that satisfy the supplied local specification.
public static IEnumerable<CilLocalVariable> FindLocals(this CilMethodBody body, LocalSpec spec)
Parameters
bodyCilMethodBodyThe CIL method body containing the local variables or instructions to search.
specLocalSpecThe specification that candidate objects must satisfy.
Returns
- IEnumerable<CilLocalVariable>
A lazily evaluated sequence of the matching items; empty when nothing matches.
FindMethod(TypeDefinition, MethodSpec)
Returns the first method declared on this type that satisfies the specification, or null.
public static MethodDefinition? FindMethod(this TypeDefinition type, MethodSpec spec)
Parameters
typeTypeDefinitionThe AsmResolver type definition on which the extension method operates.
specMethodSpecThe specification that candidate objects must satisfy.
Returns
- MethodDefinition
The first match, or null when nothing matches.
FindMethods(TypeDefinition, MethodSpec)
Enumerates methods declared directly on this type that satisfy the supplied method specification.
public static IEnumerable<MethodDefinition> FindMethods(this TypeDefinition type, MethodSpec spec)
Parameters
typeTypeDefinitionThe AsmResolver type definition on which the extension method operates.
specMethodSpecThe specification that candidate objects must satisfy.
Returns
- IEnumerable<MethodDefinition>
A lazily evaluated sequence of the matching items; empty when nothing matches.
FindNestedTypes(TypeDefinition, TypeSpec, bool)
Finds nested types declared directly by this type, optionally including all descendants.
public static IEnumerable<TypeDefinition> FindNestedTypes(this TypeDefinition type, TypeSpec spec, bool recursive = false)
Parameters
typeTypeDefinitionThe declaring type to search.
specTypeSpecThe specification that candidate nested types must satisfy.
recursiveboolWhen true, also searches nested types at every depth.
Returns
- IEnumerable<TypeDefinition>
Matching nested type definitions.
FindParameter(MethodDefinition, ParameterSpec)
Returns the first matching parameter, or null when no parameter matches.
public static Parameter? FindParameter(this MethodDefinition method, ParameterSpec spec)
Parameters
methodMethodDefinitionThe AsmResolver method definition whose parameters are searched.
specParameterSpecThe specification that candidate objects must satisfy.
Returns
FindParameters(MethodDefinition, ParameterSpec)
Enumerates parameters of this method that satisfy the supplied parameter specification.
public static IEnumerable<Parameter> FindParameters(this MethodDefinition method, ParameterSpec spec)
Parameters
methodMethodDefinitionThe AsmResolver method definition whose parameters are searched.
specParameterSpecThe specification that candidate objects must satisfy.
Returns
- IEnumerable<Parameter>
A lazily evaluated sequence of the matching items; empty when nothing matches.
FindPattern(CilMethodBody, IReadOnlyList<InstructionSpec>)
Enumerates contiguous instruction sequences that exactly match the supplied ordered pattern.
public static IEnumerable<InstructionSequence> FindPattern(this CilMethodBody body, IReadOnlyList<InstructionSpec> pattern)
Parameters
bodyCilMethodBodyThe CIL method body containing the local variables or instructions to search.
patternIReadOnlyList<InstructionSpec>The ordered instruction specifications that form the pattern.
Returns
- IEnumerable<InstructionSequence>
A lazily evaluated sequence of the matching items; empty when nothing matches.
FindProperties(TypeDefinition, PropertySpec)
Enumerates properties declared directly on this type that satisfy the supplied property specification.
public static IEnumerable<PropertyDefinition> FindProperties(this TypeDefinition type, PropertySpec spec)
Parameters
typeTypeDefinitionThe AsmResolver type definition on which the extension method operates.
specPropertySpecThe specification that candidate objects must satisfy.
Returns
- IEnumerable<PropertyDefinition>
A lazily evaluated sequence of the matching items; empty when nothing matches.
FindProperty(TypeDefinition, PropertySpec)
Returns the first property declared on this type that satisfies the specification, or null.
public static PropertyDefinition? FindProperty(this TypeDefinition type, PropertySpec spec)
Parameters
typeTypeDefinitionThe AsmResolver type definition on which the extension method operates.
specPropertySpecThe specification that candidate objects must satisfy.
Returns
- PropertyDefinition
The first match, or null when nothing matches.
GetAccessor(EventDefinition, EventAccessor)
Returns the requested accessor method for this property or event, or null when that accessor is not defined.
public static MethodDefinition? GetAccessor(this EventDefinition ev, EventAccessor accessor)
Parameters
evEventDefinitionThe event definition whose accessor is requested.
accessorEventAccessorThe property or event accessor to retrieve.
Returns
- MethodDefinition
The accessor method, or null when it is not defined.
GetAccessor(PropertyDefinition, PropertyAccessor)
Returns the requested accessor method for this property or event, or null when that accessor is not defined.
public static MethodDefinition? GetAccessor(this PropertyDefinition property, PropertyAccessor accessor)
Parameters
propertyPropertyDefinitionThe property definition whose accessor is requested.
accessorPropertyAccessorThe property or event accessor to retrieve.
Returns
- MethodDefinition
The accessor method, or null when it is not defined.