Skip to content

Latest commit

 

History

History
341 lines (304 loc) · 13.1 KB

File metadata and controls

341 lines (304 loc) · 13.1 KB

System.Reflection


AssemblyExtensions

Extensions for the System.Reflection.Assembly class.

public static class AssemblyExtensions

Static Methods

GetBeautifiedName

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.

GetExportedTypeByName

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.

GetFileVersion

Version GetFileVersion(this Assembly assembly)

Summary: Gets the file version of the assembly. Falls back to System.Reflection.AssemblyFileVersionAttribute when the assembly location is unavailable (e.g., single-file published apps where System.Reflection.Assembly.Location is empty).

Parameters:
     assembly  -  The assembly to query.

Returns: The file version, or 1.0.0.0 if the version cannot be determined.

GetResourceManagers

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.

GetTypesInheritingFromType

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.

IsDebugBuild

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.


ConstructorInfoExtensions

Extensions for the System.Reflection.ConstructorInfo class.

public static class ConstructorInfoExtensions

Static Methods

BeautifyName

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).


EventInfoExtensions

Extensions for the System.Reflection.EventInfo class.

public static class EventInfoExtensions

Static Methods

BeautifyName

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 MyEvent or EventHandler MyEvent when includeEventHandlerType is .


FieldInfoExtensions

Extensions for the System.Reflection.FieldInfo class.

public static class FieldInfoExtensions

Static Methods

BeautifyName

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].


MemberInfoExtensions

Extensions for the System.Reflection.MemberInfo class.

public static class MemberInfoExtensions

Static Methods

AnyCustomAttributes

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, .

GetUnderlyingType

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.

HasCompilerGeneratedAttribute

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, .

HasExcludeFromCodeCoverageAttribute

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, .

HasIgnoreDisplayAttribute

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, .

HasRequiredAttribute

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, .

IsPropertyWithSetter

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, .


MethodInfoExtensions

Extensions for the System.Reflection.MethodInfo class.

public static class MethodInfoExtensions

Static Methods

BeautifyName

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].

HasDeclaringTypeValidationAttributes

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, .

HasGenericParameters

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, .

IsOverride

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, .


PropertyInfoExtensions

Extensions for the System.Reflection.PropertyInfo class.

public static class PropertyInfoExtensions

Static Methods

BeautifyName

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.

GetDescription

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.

GetName

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.

IsNullable

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, .


Generated by MarkdownCodeDoc version 1.2