Class fsPortableReflection
This wraps reflection types so that it is portable across different Unity
runtimes.
Inheritance
object
fsPortableReflection
Assembly: solution.dll
Syntax
public static class fsPortableReflection
Fields
EmptyTypes
Declaration
public static Type[] EmptyTypes
Field Value
Methods
AsMemberInfo(Type)
Declaration
public static MemberInfo AsMemberInfo(Type type)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
Returns
| Type |
Description |
| MemberInfo |
|
AsType(MemberInfo)
Declaration
public static Type AsType(MemberInfo member)
Parameters
| Type |
Name |
Description |
| MemberInfo |
member |
|
Returns
GetAttribute(MemberInfo, Type, bool)
Fetches the given attribute from the given MemberInfo. This method
applies caching and is allocation free (after caching has been
performed).
Declaration
public static Attribute GetAttribute(MemberInfo element, Type attributeType, bool shouldCache)
Parameters
| Type |
Name |
Description |
| MemberInfo |
element |
The MemberInfo the get the attribute from.
|
| Type |
attributeType |
The type of attribute to fetch.
|
| bool |
shouldCache |
|
Returns
| Type |
Description |
| Attribute |
The attribute or null.
|
GetAttribute<TAttribute>(MemberInfo)
Declaration
public static TAttribute GetAttribute<TAttribute>(MemberInfo element) where TAttribute : Attribute
Parameters
| Type |
Name |
Description |
| MemberInfo |
element |
|
Returns
| Type |
Description |
| TAttribute |
|
Type Parameters
| Name |
Description |
| TAttribute |
|
GetAttribute<TAttribute>(MemberInfo, bool)
Fetches the given attribute from the given MemberInfo.
Declaration
public static TAttribute GetAttribute<TAttribute>(MemberInfo element, bool shouldCache) where TAttribute : Attribute
Parameters
| Type |
Name |
Description |
| MemberInfo |
element |
The MemberInfo to get the attribute from.
|
| bool |
shouldCache |
Should this computation be cached? If this is the only time it will
ever be done, don't bother caching.
|
Returns
| Type |
Description |
| TAttribute |
The attribute or null.
|
Type Parameters
| Name |
Description |
| TAttribute |
The type of attribute to fetch.
|
GetDeclaredConstructor(Type, Type[])
Declaration
public static ConstructorInfo GetDeclaredConstructor(this Type type, Type[] parameters)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
| Type[] |
parameters |
|
Returns
| Type |
Description |
| ConstructorInfo |
|
GetDeclaredConstructors(Type)
Declaration
public static ConstructorInfo[] GetDeclaredConstructors(this Type type)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
Returns
| Type |
Description |
| ConstructorInfo[] |
|
GetDeclaredFields(Type)
Declaration
public static FieldInfo[] GetDeclaredFields(this Type type)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
Returns
| Type |
Description |
| FieldInfo[] |
|
GetDeclaredMember(Type, string)
Declaration
public static MemberInfo GetDeclaredMember(this Type type, string memberName)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
| string |
memberName |
|
Returns
| Type |
Description |
| MemberInfo |
|
GetDeclaredMembers(Type)
Declaration
public static MemberInfo[] GetDeclaredMembers(this Type type)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
Returns
| Type |
Description |
| MemberInfo[] |
|
GetDeclaredMethod(Type, string)
Declaration
public static MethodInfo GetDeclaredMethod(this Type type, string methodName)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
| string |
methodName |
|
Returns
| Type |
Description |
| MethodInfo |
|
GetDeclaredMethods(Type)
Declaration
public static MethodInfo[] GetDeclaredMethods(this Type type)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
Returns
| Type |
Description |
| MethodInfo[] |
|
GetDeclaredProperties(Type)
Declaration
public static PropertyInfo[] GetDeclaredProperties(this Type type)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
Returns
| Type |
Description |
| PropertyInfo[] |
|
GetDeclaredProperty(Type, string)
Declaration
public static PropertyInfo GetDeclaredProperty(this Type type, string propertyName)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
| string |
propertyName |
|
Returns
| Type |
Description |
| PropertyInfo |
|
GetFlattenedMember(Type, string)
Declaration
public static MemberInfo[] GetFlattenedMember(this Type type, string memberName)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
| string |
memberName |
|
Returns
| Type |
Description |
| MemberInfo[] |
|
GetFlattenedMethod(Type, string)
Declaration
public static MethodInfo GetFlattenedMethod(this Type type, string methodName)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
| string |
methodName |
|
Returns
| Type |
Description |
| MethodInfo |
|
GetFlattenedMethods(Type, string)
Declaration
public static IEnumerable<MethodInfo> GetFlattenedMethods(this Type type, string methodName)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
| string |
methodName |
|
Returns
| Type |
Description |
| IEnumerable<MethodInfo> |
|
GetFlattenedProperty(Type, string)
Declaration
public static PropertyInfo GetFlattenedProperty(this Type type, string propertyName)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
| string |
propertyName |
|
Returns
| Type |
Description |
| PropertyInfo |
|
HasAttribute(MemberInfo, Type)
Returns true if the given attribute is defined on the given element.
Declaration
public static bool HasAttribute(MemberInfo element, Type attributeType)
Parameters
| Type |
Name |
Description |
| MemberInfo |
element |
|
| Type |
attributeType |
|
Returns
HasAttribute(MemberInfo, Type, bool)
Returns true if the given attribute is defined on the given element.
Declaration
public static bool HasAttribute(MemberInfo element, Type attributeType, bool shouldCache)
Parameters
| Type |
Name |
Description |
| MemberInfo |
element |
|
| Type |
attributeType |
|
| bool |
shouldCache |
|
Returns
HasAttribute<TAttribute>(MemberInfo)
Returns true if the given attribute is defined on the given element.
Declaration
public static bool HasAttribute<TAttribute>(MemberInfo element)
Parameters
| Type |
Name |
Description |
| MemberInfo |
element |
|
Returns
Type Parameters
| Name |
Description |
| TAttribute |
|
HasAttribute<TAttribute>(MemberInfo, bool)
Returns true if the given attribute is defined on the given element.
Declaration
public static bool HasAttribute<TAttribute>(MemberInfo element, bool shouldCache)
Parameters
| Type |
Name |
Description |
| MemberInfo |
element |
|
| bool |
shouldCache |
|
Returns
Type Parameters
| Name |
Description |
| TAttribute |
|
IsType(MemberInfo)
Declaration
public static bool IsType(MemberInfo member)
Parameters
| Type |
Name |
Description |
| MemberInfo |
member |
|
Returns
Resolve(Type)
Declaration
public static Type Resolve(this Type type)
Parameters
| Type |
Name |
Description |
| Type |
type |
|
Returns