Extensions for the System.Reflection.Assembly class.
public static class AssemblyExtensions
string GetBeautifiedName(this Assembly assembly)Summary: Gets a beautified name of the assembly by replacing dots with spaces.
Parameters:
assembly- The assembly to beautify.Returns: The beautified assembly name with dots replaced by spaces.
Type GetExportedTypeByName(this Assembly assembly, string typeName)Summary: Gets an exported type from the assembly by its type name.
Parameters:
assembly- The assembly to search.
typeName- The name of the type to find.Returns: The type if found; otherwise, null.
Version GetFileVersion(this Assembly assembly)Summary: Gets the file version of the assembly. Falls back to
System.Reflection.AssemblyFileVersionAttributewhen the assembly location is unavailable (e.g., single-file published apps whereSystem.Reflection.Assembly.Locationis empty).Parameters:
assembly- The assembly to query.Returns: The file version, or 1.0.0.0 if the version cannot be determined.
ResourceManager[] GetResourceManagers(this Assembly assembly)Summary: Gets all resource managers from the assembly.
Parameters:
assembly- The assembly to search for resource managers.Returns: An array of resource managers sorted by base name.
Type[] GetTypesInheritingFromType(this Assembly assembly, Type type)Summary: Gets all types in the assembly that inherit from a specific type.
Parameters:
assembly- The assembly to search.
type- The base type to search for inherited types.Returns: An array of types that inherit from the specified type.
bool IsDebugBuild(this Assembly assembly)Summary: Diagnostics a assembly to find out, is this complied a debug assembly.
Parameters:
assembly- The assembly.Returns: if assembly is a debug compilation, if the assembly is a release compilation.
Extensions for the System.Reflection.ConstructorInfo class.
public static class ConstructorInfoExtensions
string BeautifyName(this ConstructorInfo constructorInfo, bool useFullName = False, bool useHtmlFormat = False)Summary: Returns a human-readable representation of the constructor signature, optionally using full type names and HTML formatting for the parameter types.
Parameters:
constructorInfo- The constructor information.
useFullName- If , parameter types are rendered with their fully-qualified names.
useHtmlFormat- If , parameter type names are wrapped in HTML tags.Returns: A string of the form
.ctor(TypeA paramA, TypeB paramB).
Extensions for the System.Reflection.EventInfo class.
public static class EventInfoExtensions
string BeautifyName(this EventInfo eventInfo, bool useFullName = False, bool useHtmlFormat = False, bool includeEventHandlerType = False)Summary: Returns a human-readable representation of the event, optionally including the event handler type and using full type names or HTML formatting.
Parameters:
eventInfo- The event information.
useFullName- If , the event-handler type is rendered with its fully-qualified name.
useHtmlFormat- If , the event-handler type name is wrapped in HTML tags.
includeEventHandlerType- If , the event-handler type is prepended to the name.Returns: A string such as
MyEventorEventHandler MyEventwhenincludeEventHandlerTypeis .
Extensions for the System.Reflection.FieldInfo class.
public static class FieldInfoExtensions
string BeautifyName(this FieldInfo fieldInfo, bool useFullName = False, bool useHtmlFormat = False, bool includeReturnType = False)Summary: Beautifies the name.
Parameters:
fieldInfo- The field information.
useFullName- if set to [use full name].
useHtmlFormat- if set to [use HTML format].
includeReturnType- if set to [include return type].
Extensions for the System.Reflection.MemberInfo class.
public static class MemberInfoExtensions
bool AnyCustomAttributes(this MemberInfo element)Summary: Determines whether the member has any custom attributes of the specified type.
Parameters:
element- The member to check for custom attributes.Returns: if the member has one or more custom attributes of type
T; otherwise, .
Type GetUnderlyingType(this MemberInfo member)Summary: Gets the underlying type of the member (event, field, method return, or property type).
Parameters:
member- The member whose underlying type to retrieve.Returns: The underlying type of the member.
bool HasCompilerGeneratedAttribute(this MemberInfo memberInfo)Summary: Determines whether the member has the CompilerGenerated attribute.
Parameters:
memberInfo- The member information to check.Returns: if the member has the CompilerGenerated attribute; otherwise, .
bool HasExcludeFromCodeCoverageAttribute(this MemberInfo memberInfo)Summary: Determines whether [has exclude from code coverage attribute].
Parameters:
memberInfo- The member information.Returns: if [has exclude from code coverage attribute] [the specified member information]; otherwise, .
bool HasIgnoreDisplayAttribute(this MemberInfo memberInfo)Summary: Determines whether [has ignore display attribute].
Parameters:
memberInfo- The member information.Returns: if [has ignore display attribute] [the specified member information]; otherwise, .
bool HasRequiredAttribute(this MemberInfo memberInfo)Summary: Determines whether [has required attribute].
Parameters:
memberInfo- The member information.Returns: if [has required attribute] [the specified member information]; otherwise, .
bool IsPropertyWithSetter(this MemberInfo member)Summary: Determines whether the member is a property with a setter method.
Parameters:
member- The member to check.Returns: if the member is a property with a setter; otherwise, .
Extensions for the System.Reflection.MethodInfo class.
public static class MethodInfoExtensions
string BeautifyName(this MethodInfo methodInfo, bool useFullName = False, bool useHtmlFormat = False, bool includeReturnType = False)Summary: Beautifies the name.
Parameters:
methodInfo- The method information.
useFullName- if set to [use full name].
useHtmlFormat- if set to [use HTML format].
includeReturnType- if set to [include return type].
bool HasDeclaringTypeValidationAttributes(this MethodInfo methodInfo)Summary: Determines whether [has declaring type validation attributes].
Parameters:
methodInfo- The method information.Returns: if [has declaring type validation attributes] [the specified method information]; otherwise, .
bool HasGenericParameters(this MethodInfo methodInfo)Summary: Determines whether [has generic parameters].
Parameters:
methodInfo- The method information.Returns: if [has generic parameters] [the specified method information]; otherwise, .
bool IsOverride(this MethodInfo methodInfo)Summary: Determines whether this instance is override.
Parameters:
methodInfo- The method information.Returns: if the specified method information is override; otherwise, .
Extensions for the System.Reflection.PropertyInfo class.
public static class PropertyInfoExtensions
string BeautifyName(this PropertyInfo propertyInfo)Summary: Gets a beautified name of the property's type.
Parameters:
propertyInfo- The property information.Returns: A beautified string representation of the property's type.
string GetDescription(this PropertyInfo propertyInfo, bool useLocalizedIfPossible = True)Summary: Gets the description of the property from various description attributes or the property name.
Parameters:
propertyInfo- The property information.
useLocalizedIfPossible- If set to , attempts to use localized description first.Returns: The description of the property.
string GetName(this PropertyInfo propertyInfo)Summary: Gets the display name of the property from DisplayName, Display, or the property name itself.
Parameters:
propertyInfo- The property information.Returns: The display name of the property.
bool IsNullable(this PropertyInfo propertyInfo)Summary: Determines whether the property type is a nullable value type.
Parameters:
propertyInfo- The property information.Returns: if the property is a nullable value type; otherwise, .