Class CoreReflectionUtils
Inheritance
System.Object
CoreReflectionUtils
Assembly: Eco.Core.dll
Syntax
public static class CoreReflectionUtils : Object
Methods
AllBaseClasses(Type)
Declaration
public static IEnumerable<Type> AllBaseClasses(this Type type)
Parameters
| Type |
Name |
Description |
| System.Type |
type |
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<System.Type> |
|
AllClassesWithAttribute<T>()
Declaration
public static (Type, T)[] AllClassesWithAttribute<T>()
where T : Attribute
Returns
| Type |
Description |
| System.ValueTuple<System.Type, T>[] |
|
Type Parameters
AllControllerClassesWithAttribute<T>(Boolean)
Declaration
public static IEnumerable<(Type, T)> AllControllerClassesWithAttribute<T>(bool syncedTypesOnly)
where T : Attribute
Parameters
| Type |
Name |
Description |
| System.Boolean |
syncedTypesOnly |
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<System.ValueTuple<System.Type, T>> |
|
Type Parameters
BuildComparisonString(Object, Object, Boolean)
Declaration
public static LocString BuildComparisonString(object oldObj, object newObj, bool recursive)
Parameters
| Type |
Name |
Description |
| System.Object |
oldObj |
|
| System.Object |
newObj |
|
| System.Boolean |
recursive |
|
Returns
Cloneable(MemberInfo)
Declaration
public static bool Cloneable(this MemberInfo member)
Parameters
| Type |
Name |
Description |
| System.Reflection.MemberInfo |
member |
|
Returns
| Type |
Description |
| System.Boolean |
|
CreateDelegate(MethodInfo, Object)
Given a method info, make a delegate that calls it on the given target. Handles methods with or without return values,
as well as variable numbers of parameters.
Declaration
public static Delegate CreateDelegate(this MethodInfo methodInfo, object target)
Parameters
| Type |
Name |
Description |
| System.Reflection.MethodInfo |
methodInfo |
|
| System.Object |
target |
|
Returns
| Type |
Description |
| System.Delegate |
|
CreateGetterDelegate<T>(MethodInfo)
Declaration
public static Func<T, object> CreateGetterDelegate<T>(this MethodInfo method)
Parameters
| Type |
Name |
Description |
| System.Reflection.MethodInfo |
method |
|
Returns
| Type |
Description |
| System.Func<T, System.Object> |
|
Type Parameters
CreateSetterDelegate<T>(MethodInfo)
Declaration
public static CoreReflectionUtils.ActionWithRefParam<T, object> CreateSetterDelegate<T>(this MethodInfo method)
Parameters
| Type |
Name |
Description |
| System.Reflection.MethodInfo |
method |
|
Returns
Type Parameters
DebugName(MemberInfo)
Declaration
public static string DebugName(this MemberInfo member)
Parameters
| Type |
Name |
Description |
| System.Reflection.MemberInfo |
member |
|
Returns
| Type |
Description |
| System.String |
|
GetParentClassWithAttribute(Type, Type)
Declaration
public static Type GetParentClassWithAttribute(Type attr, Type type)
Parameters
| Type |
Name |
Description |
| System.Type |
attr |
|
| System.Type |
type |
|
Returns
| Type |
Description |
| System.Type |
|
GetPropertyTypeIndexed(PropertyInfo, Int32)
Declaration
public static Type GetPropertyTypeIndexed(this PropertyInfo prop, int index)
Parameters
| Type |
Name |
Description |
| System.Reflection.PropertyInfo |
prop |
|
| System.Int32 |
index |
|
Returns
| Type |
Description |
| System.Type |
|
GetUnderlyingType(MemberInfo, Int32)
Declaration
public static Type GetUnderlyingType(this MemberInfo member, int index = -1)
Parameters
| Type |
Name |
Description |
| System.Reflection.MemberInfo |
member |
|
| System.Int32 |
index |
|
Returns
| Type |
Description |
| System.Type |
|
GetValueIndexed(PropertyInfo, Object, Int32)
Declaration
public static object GetValueIndexed(this PropertyInfo prop, object parent, int index)
Parameters
| Type |
Name |
Description |
| System.Reflection.PropertyInfo |
prop |
|
| System.Object |
parent |
|
| System.Int32 |
index |
|
Returns
| Type |
Description |
| System.Object |
|
InstancesOfCreatableTypes<T>(Assembly, Boolean, Object[])
Declaration
public static IEnumerable<T> InstancesOfCreatableTypes<T>(Assembly assembly = null, bool includeSelf = false, params object[] constructorParams)
Parameters
| Type |
Name |
Description |
| System.Reflection.Assembly |
assembly |
|
| System.Boolean |
includeSelf |
|
| System.Object[] |
constructorParams |
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
InstancesOfCreatableTypesParallel<T>(Type, Assembly, Boolean)
Declaration
public static T[] InstancesOfCreatableTypesParallel<T>(this Type baseType, Assembly assembly = null, bool includeSelf = false)
Parameters
| Type |
Name |
Description |
| System.Type |
baseType |
|
| System.Reflection.Assembly |
assembly |
|
| System.Boolean |
includeSelf |
|
Returns
Type Parameters
IsReference(MemberInfo, Int32)
Is the given thing a referene? Return FALSE if it's a container, even if it contains references.
Declaration
public static bool IsReference(this MemberInfo member, int index = -1)
Parameters
| Type |
Name |
Description |
| System.Reflection.MemberInfo |
member |
|
| System.Int32 |
index |
|
Returns
| Type |
Description |
| System.Boolean |
|
IsReferenceOrReferenceContainer(MemberInfo, Int32)
Is the given thing a referene? Return TRUE if it's a container that can contain references.
Declaration
public static bool IsReferenceOrReferenceContainer(this MemberInfo member, int index = -1)
Parameters
| Type |
Name |
Description |
| System.Reflection.MemberInfo |
member |
|
| System.Int32 |
index |
|
Returns
| Type |
Description |
| System.Boolean |
|
IsStatic(MemberInfo)
Declaration
public static bool IsStatic(this MemberInfo member)
Parameters
| Type |
Name |
Description |
| System.Reflection.MemberInfo |
member |
|
Returns
| Type |
Description |
| System.Boolean |
|
RecursivePropertiesAndValues(Type, Object, Func<PropertyInfo, Boolean>)
Declaration
public static IEnumerable<(PropertyInfo, object)> RecursivePropertiesAndValues(this Type type, object obj, Func<PropertyInfo, bool> test)
Parameters
| Type |
Name |
Description |
| System.Type |
type |
|
| System.Object |
obj |
|
| System.Func<System.Reflection.PropertyInfo, System.Boolean> |
test |
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<System.ValueTuple<System.Reflection.PropertyInfo, System.Object>> |
|