/// <summary>
 /// Gets all the custom attributes for the specified <paramref name="module"/>.
 /// </summary>
 /// <param name="provider">The reflection provider.</param>
 /// <param name="module">The module to get custom attributes for.</param>
 /// <returns>An array that contains the custom attributes for the specified <paramref name="module"/>.</returns>
 public static IReadOnlyList <Attribute> GetCustomAttributes(this IModuleIntrospectionProvider provider, Module module)
 => (IReadOnlyList <Attribute>)NotNull(provider).GetCustomAttributes(module, typeof(Attribute), inherit: true);
 /// <summary>
 /// Gets the single custom attribute of the specified type <typeparamref name="T"/> applied to the specified <paramref name="module"/>.
 /// </summary>
 /// <typeparam name="T">The type of the custom attribute to retrieve.</typeparam>
 /// <param name="provider">The reflection provider.</param>
 /// <param name="module">The module to get the custom attribute from.</param>
 /// <returns>The single applied custom attribute instance, or null if no such attribute was found.</returns>
 public static T GetCustomAttribute <T>(this IModuleIntrospectionProvider provider, Module module) where T : Attribute
 => Single(NotNull(provider).GetCustomAttributes <T>(module));
 /// <summary>
 /// Determines whether the custom attribute of the specified <paramref name="attributeType"/> type or its derived types is applied to the specified <paramref name="module"/>.
 /// </summary>
 /// <param name="provider">The reflection provider.</param>
 /// <param name="module">The module to check the custom attribute on.</param>
 /// <param name="attributeType">The type of attribute to search for.</param>
 /// <returns>true if one or more instances of <paramref name="attributeType" /> or its derived types are applied to the specified <paramref name="module"/>; otherwise, false.</returns>
 public static bool IsDefined(this IModuleIntrospectionProvider provider, Module module, Type attributeType)
 => NotNull(provider).IsDefined(module, attributeType, inherit: true);
 /// <summary>
 /// Gets the custom attributes of the specified type <typeparamref name="T"/> applied to the specified <paramref name="module"/>.
 /// </summary>
 /// <typeparam name="T">The type of the custom attributes to retrieve.</typeparam>
 /// <param name="provider">The reflection provider.</param>
 /// <param name="module">The module to get custom attributes from.</param>
 /// <returns>A read-only list of custom attribute instances.</returns>
 public static IReadOnlyList <T> GetCustomAttributes <T>(this IModuleIntrospectionProvider provider, Module module) where T : Attribute
 => (IReadOnlyList <T>)NotNull(provider).GetCustomAttributes(module, typeof(T), inherit : true);
 /// <summary>
 /// Gets the single custom attribute of the specified type applied to the specified <paramref name="module"/>.
 /// </summary>
 /// <param name="provider">The reflection provider.</param>
 /// <param name="module">The module to get the custom attribute from.</param>
 /// <param name="attributeType">The type for which the custom attribute is to be returned. </param>
 /// <returns>The single applied custom attribute instance, or null if no such attribute was found.</returns>
 public static Attribute GetCustomAttribute(this IModuleIntrospectionProvider provider, Module module, Type attributeType)
 => Single(GetCustomAttributes(provider, module, attributeType));
Esempio n. 6
0
 /// <summary>
 /// Returns the field identified by the specified metadata token.
 /// </summary>
 /// <param name="provider">The reflection introspection provider.</param>
 /// <param name="module">The module to resolve the metadata token in.</param>
 /// <param name="metadataToken">A metadata token that identifies a field in the module.</param>
 /// <returns>A <see cref="FieldInfo" /> object representing the field that is identified by the specified metadata token.</returns>
 public static FieldInfo ResolveField(this IModuleIntrospectionProvider provider, Module module, int metadataToken) => NotNull(provider).ResolveField(module, metadataToken, genericTypeArguments: null, genericMethodArguments: null);
Esempio n. 7
0
 /// <summary>
 /// Returns the specified type, performing a case-sensitive search.
 /// </summary>
 /// <param name="provider">The reflection introspection provider.</param>
 /// <param name="module">The module to search in.</param>
 /// <param name="className">The name of the type to locate. The name must be fully qualified with the namespace.</param>
 /// <returns>A <see cref="Type"/> object representing the given type, if the type is in this module; otherwise, null.</returns>
 public static Type GetType(this IModuleIntrospectionProvider provider, Module module, string className) => NotNull(provider).GetType(module, className, throwOnError: false, ignoreCase: false);
Esempio n. 8
0
 /// <summary>
 /// Returns the global methods defined on the module.
 /// </summary>
 /// <param name="provider">The reflection introspection provider.</param>
 /// <param name="module">The module to search in.</param>
 /// <returns>An array of <see cref="MethodInfo" /> objects representing all the global methods defined on the module; if there are no global methods, an empty array is returned.</returns>
 public static IReadOnlyList <MethodInfo> GetMethods(this IModuleIntrospectionProvider provider, Module module) => NotNull(provider).GetMethods(module, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
Esempio n. 9
0
 /// <summary>
 /// Returns a method having the specified name and parameter types.
 /// </summary>
 /// <param name="provider">The reflection introspection provider.</param>
 /// <param name="module">The module to search in.</param>
 /// <param name="name">The method name.</param>
 /// <param name="types">The parameter types to search for.</param>
 /// <returns>A <see cref="MethodInfo"/> object in accordance with the specified criteria, or null if the method does not exist.</returns>
 public static MethodInfo GetMethod(this IModuleIntrospectionProvider provider, Module module, string name, Type[] types) => NotNull(provider).GetMethod(module, name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public, binder: null, CallingConventions.Any, types, modifiers: null);
Esempio n. 10
0
 /// <summary>
 /// Returns a field having the specified name.
 /// </summary>
 /// <param name="provider">The reflection introspection provider.</param>
 /// <param name="module">The module to search in.</param>
 /// <param name="name">The field name.</param>
 /// <returns>A <see cref="FieldInfo"/> object having the specified name, or null if the field does not exist.</returns>
 public static FieldInfo GetField(this IModuleIntrospectionProvider provider, Module module, string name) => NotNull(provider).GetField(module, name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);