Show / Hide Table of Contents

    Class ReflectionUtilityExtensions

    This is an extension implementation of the most common methods on the ReflectionUtility class.

    Inheritance
    System.Object
    ReflectionUtilityExtensions
    Namespace: Cuemon.Reflection
    Assembly: Cuemon.Reflection.dll
    Syntax
    public static class ReflectionUtilityExtensions

    Methods

    | Improve this Doc

    GetAssemblyTypes(Assembly)

    Gets the types contained within the specified assembly.

    Declaration
    public static IEnumerable<Type> GetAssemblyTypes(this Assembly assembly)
    Parameters
    Type Name Description
    System.Reflection.Assembly assembly

    The System.Reflection.Assembly to search the types from.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.Type>

    A sequence of all System.Type elements from the specified assembly.

    | Improve this Doc

    GetAssemblyTypes(Assembly, String)

    Gets the types contained within the specified assembly.

    Declaration
    public static IEnumerable<Type> GetAssemblyTypes(this Assembly assembly, string namespaceFilter)
    Parameters
    Type Name Description
    System.Reflection.Assembly assembly

    The System.Reflection.Assembly to search the types from.

    System.String namespaceFilter

    The namespace filter to apply on the types in the assembly.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.Type>

    A sequence of System.Type elements, matching the applied filter, from the specified assembly.

    | Improve this Doc

    GetAssemblyTypes(Assembly, String, Type)

    Gets the types contained within the specified assembly.

    Declaration
    public static IEnumerable<Type> GetAssemblyTypes(this Assembly assembly, string namespaceFilter, Type typeFilter)
    Parameters
    Type Name Description
    System.Reflection.Assembly assembly

    The System.Reflection.Assembly to search the types from.

    System.String namespaceFilter

    The namespace filter to apply on the types in the assembly.

    System.Type typeFilter

    The type filter to apply on the types in the assembly.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.Type>

    A sequence of System.Type elements, matching the applied filters, from the specified assembly.

    | Improve this Doc

    GetEmbeddedResource(Type, String)

    Loads the embedded resource from the associated System.Reflection.Assembly of the specified System.Type.

    Declaration
    public static Stream GetEmbeddedResource(this Type source, string name)
    Parameters
    Type Name Description
    System.Type source

    The source type to load the resource from.

    System.String name

    The case-sensitive name of the resource being requested.

    Returns
    Type Description
    System.IO.Stream

    A System.IO.Stream representing the loaded resource; null if no resources were specified during compilation, or if the resource is not visible to the caller.

    | Improve this Doc

    GetEmbeddedResource(Type, String, ResourceMatch)

    Loads the embedded resource from the associated System.Reflection.Assembly of the specified System.Type.

    Declaration
    public static Stream GetEmbeddedResource(this Type source, string name, ResourceMatch match)
    Parameters
    Type Name Description
    System.Type source

    The source type to load the resource from.

    System.String name

    The case-sensitive name of the resource being requested.

    ResourceMatch match

    The match ruleset to apply.

    Returns
    Type Description
    System.IO.Stream

    A System.IO.Stream representing the loaded resource; null if no resources were specified during compilation, or if the resource is not visible to the caller.

    | Improve this Doc

    GetEmbeddedResources(Type, String, ResourceMatch)

    Loads the embedded resources from the associated System.Reflection.Assembly of the specified System.Type following the ResourceMatch ruleset of match.

    Declaration
    public static IEnumerable<Stream> GetEmbeddedResources(this Type source, string name, ResourceMatch match)
    Parameters
    Type Name Description
    System.Type source

    The source type to load the resource from.

    System.String name

    The name of the resource being requested.

    ResourceMatch match

    The match ruleset to apply.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.IO.Stream>

    A System.IO.Stream representing the loaded resources; null if no resources were specified during compilation, or if the resource is not visible to the caller.

    | Improve this Doc

    GetPropertyAttributes<TDecoration>(Type)

    Gets a sequence of the specified TDecoration attribute, narrowed to property attribute decorations.

    Declaration
    public static IDictionary<PropertyInfo, TDecoration[]> GetPropertyAttributes<TDecoration>(this Type source)
        where TDecoration : Attribute
    Parameters
    Type Name Description
    System.Type source

    The source type to locate TDecoration attributes in.

    Returns
    Type Description
    System.Collections.Generic.IDictionary<System.Reflection.PropertyInfo, TDecoration[]>

    An System.Collections.Generic.IEnumerable<T> of the specified TDecoration attributes.

    Type Parameters
    Name Description
    TDecoration

    The type of the attribute to locate in source.

    Remarks

    Searches the source using the following System.Reflection.BindingFlags combination: BindingInstancePublicAndPrivateNoneInheritedIncludeStatic.

    | Improve this Doc

    GetPropertyAttributes<TDecoration>(Type, BindingFlags)

    Gets a sequence of the specified TDecoration attribute, narrowed to property attribute decorations.

    Declaration
    public static IDictionary<PropertyInfo, TDecoration[]> GetPropertyAttributes<TDecoration>(this Type source, BindingFlags bindings)
        where TDecoration : Attribute
    Parameters
    Type Name Description
    System.Type source

    The source type to locate TDecoration attributes in.

    System.Reflection.BindingFlags bindings

    A bitmask comprised of one or more System.Reflection.BindingFlags that specify how the search is conducted.

    Returns
    Type Description
    System.Collections.Generic.IDictionary<System.Reflection.PropertyInfo, TDecoration[]>

    An System.Collections.Generic.IEnumerable<T> of the specified TDecoration attributes.

    Type Parameters
    Name Description
    TDecoration

    The type of the attribute to locate in source.

    | Improve this Doc

    IsAutoProperty(PropertyInfo)

    Determines whether the specified property is considered an automatic property implementation.

    Declaration
    public static bool IsAutoProperty(this PropertyInfo property)
    Parameters
    Type Name Description
    System.Reflection.PropertyInfo property

    The property to check for automatic property implementation.

    Returns
    Type Description
    System.Boolean

    true if the specified property is considered an automatic property implementation; otherwise, false.

    Exceptions
    Type Condition
    System.ArgumentNullException

    property is null.

    | Improve this Doc

    ParseMethodParameters(Type, String, Object[])

    Parses and returns a collection of key/value pairs representing the specified methodName.

    Declaration
    public static IDictionary<string, object> ParseMethodParameters(this Type source, string methodName, params object[] methodParameters)
    Parameters
    Type Name Description
    System.Type source

    The source to locate the specified methodName in.

    System.String methodName

    The name of the method to parse on source.

    System.Object[] methodParameters

    A variable number of values passed to the methodName on this instance.

    Returns
    Type Description
    System.Collections.Generic.IDictionary<System.String, System.Object>

    A collection of key/value pairs representing the specified methodName.

    Remarks

    This method will parse the specified methodName for parameter names and tie them with methodParameters.

    Exceptions
    Type Condition
    System.ArgumentNullException

    This exception is thrown if methodName is null, if source is null or if methodParameters is null and method has resolved parameters.

    ArgumentEmptyException

    This exception is thrown if methodName is empty.

    System.ArgumentException

    This exception is thrown if either of the following is true:
    the size of methodParameters does not match the resolved parameters size of methodName,
    the type of methodParameters does not match the resolved parameters type of methodName.

    | Improve this Doc

    ParseMethodParameters(Type, String, Type[], Object[])

    Parses and returns a collection of key/value pairs representing the specified methodName.

    Declaration
    public static IDictionary<string, object> ParseMethodParameters(this Type source, string methodName, Type[] methodSignature, params object[] methodParameters)
    Parameters
    Type Name Description
    System.Type source

    The source to locate the specified methodName in.

    System.String methodName

    The name of the method to parse on source.

    System.Type[] methodSignature

    An array of System.Type objects representing the number, order, and type of the parameters for the method to get.

    System.Object[] methodParameters

    A variable number of values passed to the methodName on this instance.

    Returns
    Type Description
    System.Collections.Generic.IDictionary<System.String, System.Object>

    A collection of key/value pairs representing the specified methodName.

    Remarks

    This method will parse the specified methodName for parameter names and tie them with methodParameters.

    Exceptions
    Type Condition
    System.ArgumentNullException

    This exception is thrown if methodName is null, if source is null or if methodParameters is null and method has resolved parameters.

    ArgumentEmptyException

    This exception is thrown if methodName is empty.

    System.ArgumentException

    This exception is thrown if either of the following is true:
    the size of methodParameters does not match the resolved parameters size of methodName,
    the type of methodParameters does not match the resolved parameters type of methodName.

    • Improve this Doc
    • View Source
    Back to top Copyright 2008-2018 Weubphoria. All rights reserved.
    Generated by DocFX