Class TypeExtensions
- Namespace
- TypedRest
- Assembly
- TypedRest.dll
Provides extension methods for Type.
public static class TypeExtensions
- Inheritance
-
TypeExtensions
- Inherited Members
Methods
GetConstructor<T1, T2, TResult>()
Returns a constructor for TResult with two arguments as a function.
public static Func<T1, T2, TResult>? GetConstructor<T1, T2, TResult>()
Returns
- Func<T1, T2, TResult>
The function;
nullif no suitable constructor was found.
Type Parameters
T1The type of the first constructor argument.
T2The type of the second constructor argument.
TResultThe type to construct.
GetPropertyWith<TAttribute>(Type)
Gets a property defined on a type that is annotated with a specific TAttribute.
public static PropertyInfo? GetPropertyWith<TAttribute>(this Type type) where TAttribute : Attribute
Parameters
typeType
Returns
- PropertyInfo
The property;
nullif no such property was found.
Type Parameters
TAttribute
ToFunc<TSource, TResult>(MethodInfo)
Converts a method into a function that takes the object instance as a parameter.
public static Func<TSource, TResult> ToFunc<TSource, TResult>(this MethodInfo method)
Parameters
methodMethodInfo
Returns
- Func<TSource, TResult>
Type Parameters
TSourceThe type of the class defining the method.
TResultThe return type of the method.