AnimancerReflection Class

Summary

Reflection utilities used throughout Animancer.
Assembly
Animancer.dll
Namespace
Animancer
Base Types
  • Object
graph BT Type-->Base0["Object"] Type["AnimancerReflection"] class Type type-node

Syntax

public static class AnimancerReflection

Fields

Name Constant Value Summary
AnyAccessBindings 60
Commonly used System.Reflection.BindingFlags combinations.
static
InstanceBindings 52
Commonly used System.Reflection.BindingFlags combinations.
static
StaticBindings 56
Commonly used System.Reflection.BindingFlags combinations.
static

Methods

Name Value Summary
AppendDelegate<T>(StringBuilder, T, bool) StringBuilder
Appends the details of the `method` to the `text`.
static
AppendNameAndGenericArguments(StringBuilder, Type, bool, int) int
Appends the generic arguments of `type` (after skipping the specified number).
static
CreateDefaultInstance(Type) Object
Creates a new instance of the `type` using its parameterless constructor if it has one or a fully uninitialized object if it doesn't. Or returns null if the System.Type.IsAbstract.
static
CreateDefaultInstance<T>() T
Creates a T using its parameterless constructor if it has one or a fully uninitialized object if it doesn't. Or returns null if the System.Type.IsAbstract.
static
GetAttribute<TAttribute>(ICustomAttributeProvider, bool) TAttribute
[Animancer Extension] Returns the first TAttribute attribute on the `member` or null if there is none.
static
GetFullName(MethodInfo) string
Returns the `method`'s DeclaringType.Name.
static
GetInvocationList(MulticastDelegate) Delegate[]
Tries to use Animancer.AnimancerReflection.TryGetInvocationListNonAlloc(System.MulticastDelegate,System.Delegate[]@). Otherwise uses the regular System.MulticastDelegate.GetInvocationList.
static
GetNameCS(Type, bool) string
Returns the name of the `type` as it would appear in C# code.
static
ToStringDetailed<T>(T, bool) string
Returns a string describing the details of the `method`.
static
TryGetInvocationListNonAlloc(MulticastDelegate, Delegate[]) bool
Uses reflection to achieve the same as System.Delegate.GetInvocationList without allocating garbage every time.
  • If the delegate is null or , this method returns false and outputs null.
  • If the underlying delegate field was not found, this method returns false and outputs null.
  • If the delegate is not multicast, this method this method returns true and outputs null.
  • If the delegate is multicast, this method this method returns true and outputs its invocation list.
static
TryInvoke(Object, string, BindingFlags, Type[], Object[]) Object
Invokes a method with the specified `methodName` if it exists on the `obj`.
static