Table of Contents

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; null if no suitable constructor was found.

Type Parameters

T1

The type of the first constructor argument.

T2

The type of the second constructor argument.

TResult

The 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

type Type

Returns

PropertyInfo

The property; null if 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

method MethodInfo

Returns

Func<TSource, TResult>

Type Parameters

TSource

The type of the class defining the method.

TResult

The return type of the method.