Interface IResolver
- Namespace
- Utils.Expressions
- Assembly
- Utils.dll
Provides functionality to resolve types, constructors, methods, and members at runtime, as well as to manage constants in expressions.
public interface IResolver
- Extension Methods
Methods
GetConstructors(Type)
Retrieves all public constructors for the specified type.
ConstructorInfo[] GetConstructors(Type type)
Parameters
Returns
- ConstructorInfo[]
An array of ConstructorInfo objects.
GetInstanceMethods(Type, string)
Retrieves a list of instance methods on the specified type that match the given method name.
MethodInfo[] GetInstanceMethods(Type type, string name)
Parameters
Returns
- MethodInfo[]
An array of MethodInfo objects representing the matching methods.
GetInstancePropertyOrField(Type, string)
Retrieves an instance property or field on the specified type, by name.
MemberInfo GetInstancePropertyOrField(Type type, string name)
Parameters
Returns
- MemberInfo
A MemberInfo representing the instance property or field, or null if it cannot be found.
GetStaticMethods(Type, string)
Retrieves a list of static methods on the specified type that match the given method name.
MethodInfo[] GetStaticMethods(Type type, string name)
Parameters
Returns
- MethodInfo[]
An array of MethodInfo objects representing the matching methods.
GetStaticPropertyOrField(Type, string)
Retrieves a static property or field on the specified type, by name.
MemberInfo GetStaticPropertyOrField(Type type, string name)
Parameters
Returns
- MemberInfo
A MemberInfo representing the static property or field, or null if it cannot be found.
ResolveType(string)
Attempts to resolve a type by its name.
Type ResolveType(string name)
Parameters
namestringThe name of the type to resolve, potentially including a namespace.
Returns
ResolveType(string, Type[])
Attempts to resolve a generic type by its name, using the provided generic parameters.
Type ResolveType(string name, Type[] genericParameters)
Parameters
namestringThe name of the type to resolve.
genericParametersType[]An array of types to use as generic arguments.
Returns
SelectConstructor(IEnumerable<ConstructorInfo>, Expression[])
Attempts to select the best matching constructor from a collection, given an array of argument expressions.
(ConstructorInfo Method, Expression[] Parameters)? SelectConstructor(IEnumerable<ConstructorInfo> constructors, Expression[] arguments)
Parameters
constructorsIEnumerable<ConstructorInfo>An enumerable of candidate ConstructorInfo objects.
argumentsExpression[]The expressions representing constructor arguments.
Returns
- (ConstructorInfo Method, Expression[] Parameters)?
A tuple of (ConstructorInfo, Expression[]) if a suitable match is found; otherwise null.
SelectMethod(IEnumerable<MethodInfo>, Expression, Type[], Expression[])
Attempts to select the best matching method from a collection, given a target (object expression), optional generic parameters, and an array of argument expressions.
(MethodInfo Method, Expression[] Parameters)? SelectMethod(IEnumerable<MethodInfo> methods, Expression obj, Type[] genericParameters, Expression[] arguments)
Parameters
methodsIEnumerable<MethodInfo>An enumerable of candidate MethodInfo objects.
objExpressionAn expression for the method's target object, or null for static methods.
genericParametersType[]An optional array of generic arguments for a generic method.
argumentsExpression[]Expressions representing the method arguments.
Returns
- (MethodInfo Method, Expression[] Parameters)?
A tuple of (MethodInfo, Expression[]) if a suitable match is found; otherwise null.
TryGetConstant(string, out ConstantExpression)
Attempts to retrieve a constant expression associated with the specified name.
bool TryGetConstant(string name, out ConstantExpression constantExpression)
Parameters
namestringThe name that might correspond to a constant value.
constantExpressionConstantExpressionWhen this method returns, contains a ConstantExpression if one was found; otherwise null.