Class TypeHelper
- Namespace
- Dynamicweb.Extensibility
- Assembly
- Dynamicweb.Core.dll
public static class TypeHelper
- Inheritance
-
TypeHelper
- Inherited Members
Methods
GetCustomAttribute<T>(MemberInfo)
public static T? GetCustomAttribute<T>(MemberInfo member) where T : Attribute
Parameters
member
MemberInfo
Returns
- T
Type Parameters
T
GetCustomAttribute<T>(MemberInfo, bool)
public static T? GetCustomAttribute<T>(MemberInfo member, bool inherit) where T : Attribute
Parameters
member
MemberInfoinherit
bool
Returns
- T
Type Parameters
T
GetCustomAttributes<T>(MemberInfo)
public static IEnumerable<T> GetCustomAttributes<T>(MemberInfo member) where T : Attribute
Parameters
member
MemberInfo
Returns
- IEnumerable<T>
Type Parameters
T
GetCustomAttributes<T>(MemberInfo, bool)
public static IEnumerable<T> GetCustomAttributes<T>(MemberInfo member, bool inherit) where T : Attribute
Parameters
member
MemberInfoinherit
bool
Returns
- IEnumerable<T>
Type Parameters
T
GetGenericTypeArguments(Type, Type)
public static Type[] GetGenericTypeArguments(Type type, Type baseType)
Parameters
Returns
- Type[]
GetProperty(Type, string)
public static PropertyInfo? GetProperty(Type type, string propertyName)
Parameters
Returns
GetPropertyFromExpression(Expression)
public static PropertyInfo? GetPropertyFromExpression(Expression expression)
Parameters
expression
Expression
Returns
GetPropertyValue(object, string)
public static object? GetPropertyValue(object instance, string propertyName)
Parameters
Returns
GetTypeNameWithAssembly(Type)
Get name of the type in format "[FullName], [AssemblyName]"
public static string GetTypeNameWithAssembly(Type type)
Parameters
type
Type
Returns
GetTypeNameWithoutAssembly(string)
public static string GetTypeNameWithoutAssembly(string typeName)
Parameters
typeName
string
Returns
HasCustomAttribute<T>(MemberInfo)
public static bool HasCustomAttribute<T>(MemberInfo member) where T : Attribute
Parameters
member
MemberInfo
Returns
Type Parameters
T
InvokeMethod(object, string, object?[]?)
Invokes the method of the specfied name on the specified instance with the specified parameters.
public static object? InvokeMethod(object instance, string methodName, object?[]? arguments)
Parameters
instance
objectThe instance.
methodName
stringName of the method.
arguments
object[]The arguments.
Returns
InvokeStaticGenericMethod<T>(Type, Type, string, params object?[])
Invokes a static method on the given generic type.
public static T? InvokeStaticGenericMethod<T>(Type type, Type genericType, string methodName, params object?[] arguments)
Parameters
type
TypeThe type.
genericType
TypeThe generic type.
methodName
stringName of method.
arguments
object[]The arguments.
Returns
- T
Type Parameters
T
Type of returned result.
InvokeStaticMethod(Type, string, object?[]?)
Invokes a static method on the given type. The method must be static and public. The params array must contain elements that exactly match a signature for given method.
public static object? InvokeStaticMethod(Type type, string methodName, object?[]? arguments)
Parameters
Returns
IsDerivedFrom(Type, Type, params Type[])
public static bool IsDerivedFrom(Type type, Type baseType, params Type[] genericTypeParameters)
Parameters
Returns
IsDerivedFrom<TBase>(Type, params Type[])
public static bool IsDerivedFrom<TBase>(Type type, params Type[] genericTypeParameters)
Parameters
Returns
Type Parameters
TBase
IsTypeNameWithAssembly(string)
public static bool IsTypeNameWithAssembly(string typeName)
Parameters
typeName
string
Returns
SetPropertyValue(object, string, object?)
public static void SetPropertyValue(object instance, string propertyName, object? propertyValue)
Parameters
TryGetProperty(Type, string, out PropertyInfo?)
public static bool TryGetProperty(Type type, string propertyName, out PropertyInfo? property)
Parameters
type
TypepropertyName
stringproperty
PropertyInfo
Returns
TryGetPropertyValue(object?, string?, out object?)
public static bool TryGetPropertyValue(object? instance, string? propertyName, out object? value)
Parameters
Returns
TryInvokeMethod(object, string, object?[]?, out object?)
public static bool TryInvokeMethod(object instance, string methodName, object?[]? arguments, out object? value)
Parameters
Returns
TryInvokeStaticMethod(Type, string, object?[]?, out object?)
public static bool TryInvokeStaticMethod(Type type, string methodName, object?[]? arguments, out object? value)
Parameters
Returns
TrySetPropertyValue(object, string, object?)
public static bool TrySetPropertyValue(object instance, string propertyName, object? value)