Esempio n. 1
0
 /// <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));
Esempio n. 2
0
 public object GetValue(object o)
 => ReflectedElement.GetValue(o);
Esempio n. 3
0
 /// <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);
Esempio n. 4
0
 public object Invoke(object instance, object[] args)
 => ReflectedElement.Invoke(instance, args);
Esempio n. 5
0
 public override bool HasAttribute <A>()
 => ReflectedElement.HasAttribute <A>();
Esempio n. 6
0
 /// <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);
Esempio n. 7
0
 /// <summary>
 /// Describes the assembly in terms of a <see cref="ComponentDescriptor"/>
 /// </summary>
 /// <returns></returns>
 public Option <ComponentDescriptor> Describe()
 => Try(() => ReflectedElement.ComponentDescriptor());
Esempio n. 8
0
 /// <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());
Esempio n. 9
0
 /// <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);
Esempio n. 10
0
 /// <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);
Esempio n. 11
0
 /// <summary>
 /// Invokes a static method
 /// </summary>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public object Invoke(params object[] parameters)
 => ReflectedElement.Invoke(null, parameters.ToArray());
Esempio n. 12
0
 public ClrType GetLiteralType()
 => ClrType.Get(ReflectedElement.GetEnumUnderlyingType());
Esempio n. 13
0
 /// <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>();
Esempio n. 14
0
 /// <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);
Esempio n. 15
0
 /// <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))));
Esempio n. 16
0
 /// <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));
Esempio n. 17
0
 /// <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);
Esempio n. 18
0
 /// <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);
Esempio n. 19
0
 /// <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>();
Esempio n. 20
0
 /// <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);
Esempio n. 21
0
 /// <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>();
Esempio n. 22
0
 public override bool Equals(object obj)
 => ReflectedElement.Equals(obj);
Esempio n. 23
0
 public TResult Invoke <TResult>(object instance, object[] args)
 => (TResult)ReflectedElement.Invoke(instance, args);
Esempio n. 24
0
 public override int GetHashCode()
 => ReflectedElement.GetHashCode();
Esempio n. 25
0
 public override Option <A> Attribute <A>()
 => ReflectedElement.GetCustomAttribute <A>();
Esempio n. 26
0
 /// <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);
Esempio n. 27
0
 public void SetValue(object o, object value)
 => ReflectedElement.SetValue(o, value);
Esempio n. 28
0
 /// <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>();