/// <summary> /// Determines whether the class is a subclass of another /// </summary> /// <typeparam name="T">The supertype to test</typeparam> /// <returns></returns> public bool IsSublcassOf <T>() => ReflectedElement.IsSubclassOf(typeof(T));
public object GetValue(object o) => ReflectedElement.GetValue(o);
/// <summary> /// Determines whether a type is a subclass of the adapted type /// </summary> /// <param name="t">The type to test</param> /// <returns></returns> public bool IsSubclassOf(Type t) => ReflectedElement.IsSubclassOf(t);
public object Invoke(object instance, object[] args) => ReflectedElement.Invoke(instance, args);
public override bool HasAttribute <A>() => ReflectedElement.HasAttribute <A>();
/// <summary> /// Conditionally extracts the text resources defined in the assembly /// </summary> /// <param name="match">The resource name match pattern</param> /// <returns></returns> public IEnumerable <TextResource> TextResources(string match) => ReflectedElement.GetResourceProvider().TextResources(match);
/// <summary> /// Describes the assembly in terms of a <see cref="ComponentDescriptor"/> /// </summary> /// <returns></returns> public Option <ComponentDescriptor> Describe() => Try(() => ReflectedElement.ComponentDescriptor());
/// <summary> /// Invokes a static method /// </summary> /// <typeparam name="TResult">The method's return type</typeparam> /// <param name="parameters"></param> /// <returns></returns> public TResult Invoke <TResult>(params object[] parameters) => (TResult)ReflectedElement.Invoke(null, parameters.ToArray());
/// <summary> /// Invokes a non-static method /// </summary> /// <param name="host">An instance of the defining type</param> /// <param name="parameters"></param> /// <returns></returns> public object InvokeOnHost(object host, params object[] parameters) => ReflectedElement.Invoke(host, parameters);
/// <summary> /// Creates a function that accepts 4 typed parameters and returns an typed result /// </summary> /// <typeparam name="X1">The type of the first parameter</typeparam> /// <typeparam name="X2">The type of the second parameter</typeparam> /// <typeparam name="X3">Tye type of the third parameter</typeparam> /// <typeparam name="X4">Tye type of the fourth parameter</typeparam> /// <typeparam name="Y">The result type</typeparam> /// <param name="Host">An instance of the declaring type, if applicable</param> /// <returns></returns> public Func <X1, X2, X3, X4, Y> Func <X1, X2, X3, X4, Y>(object Host = null) => ReflectedElement.Func <X1, X2, X3, X4, Y>(Host);
/// <summary> /// Invokes a static method /// </summary> /// <param name="parameters"></param> /// <returns></returns> public object Invoke(params object[] parameters) => ReflectedElement.Invoke(null, parameters.ToArray());
public ClrType GetLiteralType() => ClrType.Get(ReflectedElement.GetEnumUnderlyingType());
/// <summary> /// Determines whether the adapted type conforms to an interface <typeparamref name="T"/> /// </summary> /// <typeparam name="T">The interface type to test</typeparam> /// <returns></returns> public bool Realizes <T>() => ReflectedElement.Realizes <T>();
/// <summary> /// Determines whether the adapted type conforms to a specified interface /// </summary> /// <param name="i">The interface to test</param> /// <returns></returns> public bool Realizes(ClrInterface i) => ReflectedElement.Realizes(i.ReflectedElement);
/// <summary> /// If the adapted method is a generic method definition with the supplied number and /// type of parameters, closes the method with the supplied arguments /// </summary> /// <param name="args"></param> /// <returns></returns> public Option <ClrMethod> CloseGenericMethod(params ClrType[] args) => Try(() => ClrMethod.Get(ReflectedElement.MakeGenericMethod(array(args, a => a.ReflectedElement))));
/// <summary> /// Invokes a non-static method /// </summary> /// <param name="host">An instance of the defining type</param> /// <param name="parameters"></param> /// <returns></returns> public TResult InvokeOnHost <TResult>(object host, params object[] parameters) => cast <TResult>(ReflectedElement.Invoke(host, parameters));
/// <summary> /// Creates a closed generic method from this (presumably) open generic method /// </summary> /// <param name="types">The method type arguments</param> /// <returns></returns> public ClrMethod Close(params Type[] types) => ReflectedElement.MakeGenericMethod(types);
/// <summary> /// Gets the value of the property and converts the value to the supplied type /// </summary> public object GetValue(object o, Type conversionType) => Convert.ChangeType(ReflectedElement.GetValue(o), conversionType);
/// <summary> /// Returns an associatiave array that pairs types and applied attributes /// </summary> /// <typeparam name="A">The attribute type</typeparam> /// <returns></returns> public IDictionary <Type, A> TypeAttributions <A>() where A : Attribute => ReflectedElement.GetTypeAttributions <A>();
/// <summary> /// Gets the value of the property and either casts or converts the value to the supplied type /// </summary> /// <typeparam name="V">The value's type</typeparam> /// <param name="o">The defining object</param> /// <param name="convert"></param> /// <returns></returns> public V GetValue <V>(object o, bool convert = false) => convert ? (V)Convert.ChangeType(ReflectedElement.GetValue(o), typeof(V)) : (V)ReflectedElement.GetValue(o);
/// <summary> /// Attemps to get the value of a specified attribute /// </summary> /// <typeparam name="A">The attribute type</typeparam> /// <returns></returns> public override Option <A> Attribute <A>() => ReflectedElement.TryGetAttribute <A>();
public override bool Equals(object obj) => ReflectedElement.Equals(obj);
public TResult Invoke <TResult>(object instance, object[] args) => (TResult)ReflectedElement.Invoke(instance, args);
public override int GetHashCode() => ReflectedElement.GetHashCode();
public override Option <A> Attribute <A>() => ReflectedElement.GetCustomAttribute <A>();
/// <summary> /// Determines whether the class is a subclass of another /// </summary> /// <param name="candidate">The supertype to test</param> /// <returns></returns> public bool IsSublcassOf(ClrClass candidate) => ReflectedElement.IsSubclassOf(candidate);
public void SetValue(object o, object value) => ReflectedElement.SetValue(o, value);
/// <summary> /// Determines whether the adapted type is of type <see cref="Nullable{T}"/> /// </summary> /// <typeparam name="T">The type to test</typeparam> /// <returns></returns> public bool IsNullableTypeOf <T>() => ReflectedElement.IsNullableType <T>();