Class Meta
Constains static analysis methods of the code (reflection).
Inheritance
Namespace: Towel
Assembly: Towel.dll
Syntax
public static class Meta : object
Methods
| Improve this Doc View SourceClearXmlDocumentation()
Clears the currently loaded XML documentation.
Declaration
public static void ClearXmlDocumentation()
ConvertToCSharpSource(Type, Boolean)
Converts a
Declaration
public static string ConvertToCSharpSource(this Type type, bool showGenericParameters = false)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The |
System.Boolean | showGenericParameters | If the generic parameters are the generic types, whether they should be shown or not. |
Returns
Type | Description |
---|---|
System.String | The |
GetConstructorInfosWithAttribute<TAttribute>(Assembly)
Enumerates through all the constructors with a custom attribute.
Declaration
public static System.Collections.Generic.IEnumerable<ConstructorInfo> GetConstructorInfosWithAttribute<TAttribute>(this Assembly assembly)
where TAttribute : Attribute
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | The assembly to iterate through the constructors of. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ConstructorInfo> | The IEnumerable of the constructors with the provided attribute type. |
Type Parameters
Name | Description |
---|---|
TAttribute | The type of the custom attribute. |
GetDerivedTypes<TBase>(Assembly)
Gets all the types in an assembly that derive from a base.
Declaration
public static System.Collections.Generic.IEnumerable<Type> GetDerivedTypes<TBase>(this Assembly assembly)
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | The assmebly to perform the search on. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Type> | The IEnumerable of the types that derive from the provided base. |
Type Parameters
Name | Description |
---|---|
TBase | The base type to get the deriving types of. |
GetDirectoryPath(Assembly)
Gets the file path of an assembly.
Declaration
public static string? GetDirectoryPath(this Assembly assembly)
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | The assembly to get the file path of. |
Returns
Type | Description |
---|---|
System.Nullable<System.String> | The file path of the assembly. |
GetDocumentation(ConstructorInfo)
Gets the XML documentation on a constructor.
Declaration
public static string? GetDocumentation(this ConstructorInfo constructorInfo)
Parameters
Type | Name | Description |
---|---|---|
ConstructorInfo | constructorInfo | The constructor to get the XML documentation of. |
Returns
Type | Description |
---|---|
System.Nullable<System.String> | The XML documentation on the constructor. |
Remarks
The XML documentation must be loaded into memory for this function to work.
GetDocumentation(EventInfo)
Gets the XML documentation on an event.
Declaration
public static string? GetDocumentation(this EventInfo eventInfo)
Parameters
Type | Name | Description |
---|---|---|
EventInfo | eventInfo | The event to get the XML documentation of. |
Returns
Type | Description |
---|---|
System.Nullable<System.String> | The XML documentation on the event. |
Remarks
The XML documentation must be loaded into memory for this function to work.
GetDocumentation(FieldInfo)
Gets the XML documentation on a field.
Declaration
public static string? GetDocumentation(this FieldInfo fieldInfo)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | fieldInfo | The field to get the XML documentation of. |
Returns
Type | Description |
---|---|
System.Nullable<System.String> | The XML documentation on the field. |
Remarks
The XML documentation must be loaded into memory for this function to work.
GetDocumentation(MemberInfo)
Gets the XML documentation on a member.
Declaration
public static string? GetDocumentation(this MemberInfo memberInfo)
Parameters
Type | Name | Description |
---|---|---|
MemberInfo | memberInfo | The member to get the XML documentation of. |
Returns
Type | Description |
---|---|
System.Nullable<System.String> | The XML documentation on the member. |
Remarks
The XML documentation must be loaded into memory for this function to work.
GetDocumentation(MethodInfo)
Gets the XML documentation on a method.
Declaration
public static string? GetDocumentation(this MethodInfo methodInfo)
Parameters
Type | Name | Description |
---|---|---|
MethodInfo | methodInfo | The method to get the XML documentation of. |
Returns
Type | Description |
---|---|
System.Nullable<System.String> | The XML documentation on the method. |
Remarks
The XML documentation must be loaded into memory for this function to work.
GetDocumentation(ParameterInfo)
Gets the XML documentation for a parameter.
Declaration
public static string? GetDocumentation(this ParameterInfo parameterInfo)
Parameters
Type | Name | Description |
---|---|---|
ParameterInfo | parameterInfo | The parameter to get the XML documentation for. |
Returns
Type | Description |
---|---|
System.Nullable<System.String> | The XML documenation of the parameter. |
GetDocumentation(PropertyInfo)
Gets the XML documentation on a property.
Declaration
public static string? GetDocumentation(this PropertyInfo propertyInfo)
Parameters
Type | Name | Description |
---|---|---|
PropertyInfo | propertyInfo | The property to get the XML documentation of. |
Returns
Type | Description |
---|---|
System.Nullable<System.String> | The XML documentation on the property. |
Remarks
The XML documentation must be loaded into memory for this function to work.
GetDocumentation(Type)
Gets the XML documentation on a type.
Declaration
public static string? GetDocumentation(this Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The type to get the XML documentation of. |
Returns
Type | Description |
---|---|
System.Nullable<System.String> | The XML documentation on the type. |
Remarks
The XML documentation must be loaded into memory for this function to work.
GetEnumAttribute<TAttribute>(Enum)
Gets a custom attribute on an enum value by generic type.
Declaration
public static TAttribute GetEnumAttribute<TAttribute>(this Enum enum)
where TAttribute : Attribute
Parameters
Type | Name | Description |
---|---|---|
Enum | enum | The enum value to get the attribute of. |
Returns
Type | Description |
---|---|
TAttribute | The attribute on the enum value of the provided type. |
Type Parameters
Name | Description |
---|---|
TAttribute | The type of attribute to get. |
GetEnumAttributes<TAttribute>(Enum)
Gets custom attributes on an enum value by generic type.
Declaration
public static System.Collections.Generic.IEnumerable<TAttribute> GetEnumAttributes<TAttribute>(this Enum enum)
where TAttribute : Attribute
Parameters
Type | Name | Description |
---|---|---|
Enum | enum | The enum value to get the attribute of. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TAttribute> | The attributes on the enum value of the provided type. |
Type Parameters
Name | Description |
---|---|
TAttribute | The type of attribute to get. |
GetEventInfosWithAttribute<TAttribute>(Assembly)
Enumerates through all the events with a custom attribute.
Declaration
public static System.Collections.Generic.IEnumerable<EventInfo> GetEventInfosWithAttribute<TAttribute>(this Assembly assembly)
where TAttribute : Attribute
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | The assembly to iterate through the events of. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<EventInfo> | The IEnumerable of the events with the provided attribute type. |
Type Parameters
Name | Description |
---|---|
TAttribute | The type of the custom attribute. |
GetFactorialMethod(Type)
Gets the Factorial a
)].
Declaration
public static MethodInfo? GetFactorialMethod(Type a)
Parameters
Type | Name | Description |
---|---|---|
Type | a | The type of the out parameter. |
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsNonNegative |
GetFactorialMethod<T>()
Gets the Factorial T
)].
Declaration
public static MethodInfo? GetFactorialMethod<T>()
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsPrime |
Type Parameters
Name | Description |
---|---|
T | The type of the out parameter. |
GetFieldInfosWithAttribute<TAttribute>(Assembly)
Enumerates through all the fields with a custom attribute.
Declaration
public static System.Collections.Generic.IEnumerable<FieldInfo> GetFieldInfosWithAttribute<TAttribute>(this Assembly assembly)
where TAttribute : Attribute
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | The assembly to iterate through the fields of. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<FieldInfo> | The IEnumerable of the fields with the provided attribute type. |
Type Parameters
Name | Description |
---|---|
TAttribute | The type of the custom attribute. |
GetGreaterThanMethod<TA, TB, TC>()
Determines if an op_GreaterThan member exists.
Declaration
public static MethodInfo? GetGreaterThanMethod<TA, TB, TC>()
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | True if the op_GreaterThan member exists or false if not. |
Type Parameters
Name | Description |
---|---|
TA | The type of the left operand. |
TB | The type of the right operand. |
TC | The type of the return. |
GetIsEvenMethod(Type)
Gets the IsEven a
)].
Declaration
public static MethodInfo? GetIsEvenMethod(Type a)
Parameters
Type | Name | Description |
---|---|---|
Type | a | The type of the out parameter. |
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsEven |
GetIsEvenMethod<T>()
Gets the IsEven T
)].
Declaration
public static MethodInfo? GetIsEvenMethod<T>()
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsEven |
Type Parameters
Name | Description |
---|---|
T | The type of the out parameter. |
GetIsIntegerMethod(Type)
Gets the IsInteger a
)].
Declaration
public static MethodInfo? GetIsIntegerMethod(Type a)
Parameters
Type | Name | Description |
---|---|---|
Type | a | The type of the out parameter. |
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The TryParse |
GetIsIntegerMethod<T>()
Gets the IsInteger T
)].
Declaration
public static MethodInfo? GetIsIntegerMethod<T>()
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The TryParse |
Type Parameters
Name | Description |
---|---|
T | The type of the out parameter. |
GetIsNegativeMethod(Type)
Gets the IsNegative a
)].
Declaration
public static MethodInfo? GetIsNegativeMethod(Type a)
Parameters
Type | Name | Description |
---|---|---|
Type | a | The type of the out parameter. |
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsNegative |
GetIsNegativeMethod<T>()
Gets the IsNegative T
)].
Declaration
public static MethodInfo? GetIsNegativeMethod<T>()
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsNegative |
Type Parameters
Name | Description |
---|---|
T | The type of the out parameter. |
GetIsNonNegativeMethod(Type)
Gets the IsNonNegative a
)].
Declaration
public static MethodInfo? GetIsNonNegativeMethod(Type a)
Parameters
Type | Name | Description |
---|---|---|
Type | a | The type of the out parameter. |
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsNonNegative |
GetIsNonNegativeMethod<T>()
Gets the IsNonNegative T
)].
Declaration
public static MethodInfo? GetIsNonNegativeMethod<T>()
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsNonNegative |
Type Parameters
Name | Description |
---|---|
T | The type of the out parameter. |
GetIsOddMethod(Type)
Gets the IsOdd a
)].
Declaration
public static MethodInfo? GetIsOddMethod(Type a)
Parameters
Type | Name | Description |
---|---|---|
Type | a | The type of the out parameter. |
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsOdd |
GetIsOddMethod<T>()
Gets the IsOdd T
)].
Declaration
public static MethodInfo? GetIsOddMethod<T>()
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsOdd |
Type Parameters
Name | Description |
---|---|
T | The type of the out parameter. |
GetIsPositiveMethod(Type)
Gets the IsPositive a
)].
Declaration
public static MethodInfo? GetIsPositiveMethod(Type a)
Parameters
Type | Name | Description |
---|---|---|
Type | a | The type of the out parameter. |
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsPositive |
GetIsPositiveMethod<T>()
Gets the IsPositive T
)].
Declaration
public static MethodInfo? GetIsPositiveMethod<T>()
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsPositive |
Type Parameters
Name | Description |
---|---|
T | The type of the out parameter. |
GetIsPrimeMethod(Type)
Gets the IsPrime a
)].
Declaration
public static MethodInfo? GetIsPrimeMethod(Type a)
Parameters
Type | Name | Description |
---|---|---|
Type | a | The type of the out parameter. |
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsNonNegative |
GetIsPrimeMethod<T>()
Gets the IsPrime T
)].
Declaration
public static MethodInfo? GetIsPrimeMethod<T>()
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The IsPrime |
Type Parameters
Name | Description |
---|---|
T | The type of the out parameter. |
GetLastEnumValue<TEnum>()
Gets the maximum value of an enum.
Declaration
public static TEnum GetLastEnumValue<TEnum>()
where TEnum : struct, Enum
Returns
Type | Description |
---|---|
TEnum | The maximum enum value of the provided type. |
Type Parameters
Name | Description |
---|---|
TEnum | The enum type to get the maximum value of. |
GetLessThanMethod<TA, TB, TC>()
Determines if an op_LessThan member exists.
Declaration
public static MethodInfo? GetLessThanMethod<TA, TB, TC>()
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | True if the op_LessThan member exists or false if not. |
Type Parameters
Name | Description |
---|---|
TA | The type of the left operand. |
TB | The type of the right operand. |
TC | The type of the return. |
GetMethodInfosWithAttribute<TAttribute>(Assembly)
Enumerates through all the methods with a custom attribute.
Declaration
public static System.Collections.Generic.IEnumerable<MethodInfo> GetMethodInfosWithAttribute<TAttribute>(this Assembly assembly)
where TAttribute : Attribute
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | The assembly to iterate through the methods of. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<MethodInfo> | The IEnumerable of the methods with the provided attribute type. |
Type Parameters
Name | Description |
---|---|
TAttribute | The type of the custom attribute. |
GetPropertyInfosWithAttribute<TAttribute>(Assembly)
Enumerates through all the properties with a custom attribute.
Declaration
public static System.Collections.Generic.IEnumerable<PropertyInfo> GetPropertyInfosWithAttribute<TAttribute>(this Assembly assembly)
where TAttribute : Attribute
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | The assembly to iterate through the properties of. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<PropertyInfo> | The IEnumerable of the properties with the provided attribute type. |
Type Parameters
Name | Description |
---|---|
TAttribute | The type of the custom attribute. |
GetTryParseMethod(Type)
Gets the TryParse a
)].
Declaration
public static MethodInfo? GetTryParseMethod(Type a)
Parameters
Type | Name | Description |
---|---|---|
Type | a | The type of the out parameter. |
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The TryParse |
GetTryParseMethod<T>()
Gets the TryParse T
)].
Declaration
public static MethodInfo? GetTryParseMethod<T>()
Returns
Type | Description |
---|---|
System.Nullable<MethodInfo> | The TryParse |
Type Parameters
Name | Description |
---|---|
T | The type of the out parameter. |
GetTypesWithAttribute<TAttribute>(Assembly)
Enumerates through all the types with a custom attribute.
Declaration
public static System.Collections.Generic.IEnumerable<Type> GetTypesWithAttribute<TAttribute>(this Assembly assembly)
where TAttribute : Attribute
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | The assembly to iterate through the types of. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Type> | The IEnumerable of the types with the provided attribute type. |
Type Parameters
Name | Description |
---|---|
TAttribute | The type of the custom attribute. |
GetXmlName(ConstructorInfo)
Gets the XML name of an
Declaration
public static string GetXmlName(this ConstructorInfo constructorInfo)
Parameters
Type | Name | Description |
---|---|---|
ConstructorInfo | constructorInfo | The field to get the XML name of. |
Returns
Type | Description |
---|---|
System.String | The XML name of |
GetXmlName(EventInfo)
Gets the XML name of an
Declaration
public static string GetXmlName(this EventInfo eventInfo)
Parameters
Type | Name | Description |
---|---|---|
EventInfo | eventInfo | The event to get the XML name of. |
Returns
Type | Description |
---|---|
System.String | The XML name of |
GetXmlName(FieldInfo)
Gets the XML name of an
Declaration
public static string GetXmlName(this FieldInfo fieldInfo)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | fieldInfo | The field to get the XML name of. |
Returns
Type | Description |
---|---|
System.String | The XML name of |
GetXmlName(MethodInfo)
Gets the XML name of an
Declaration
public static string GetXmlName(this MethodInfo methodInfo)
Parameters
Type | Name | Description |
---|---|---|
MethodInfo | methodInfo | The field to get the XML name of. |
Returns
Type | Description |
---|---|
System.String | The XML name of |
GetXmlName(PropertyInfo)
Gets the XML name of an
Declaration
public static string GetXmlName(this PropertyInfo propertyInfo)
Parameters
Type | Name | Description |
---|---|---|
PropertyInfo | propertyInfo | The field to get the XML name of. |
Returns
Type | Description |
---|---|
System.String | The XML name of |
GetXmlName(Type)
Gets the XML name of an
Declaration
public static string GetXmlName(this Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The field to get the XML name of. |
Returns
Type | Description |
---|---|
System.String | The XML name of |
HasExplicitCast(Type, Type)
Determines if an implicit casting operator exists from one type to another.
Declaration
public static bool HasExplicitCast(Type fromType, Type toType)
Parameters
Type | Name | Description |
---|---|---|
Type | fromType | The parameter type of the implicit casting operator. |
Type | toType | The return type fo the implicit casting operator. |
Returns
Type | Description |
---|---|
System.Boolean | True if the implicit casting operator exists or false if not. |
HasExplicitCast<TFrom, TTo>()
Determines if an implicit casting operator exists from one type to another.
Declaration
public static bool HasExplicitCast<TFrom, TTo>()
Returns
Type | Description |
---|---|
System.Boolean | True if the implicit casting operator exists or false if not. |
Type Parameters
Name | Description |
---|---|
TFrom | The parameter type of the implicit casting operator. |
TTo | The return type fo the implicit casting operator. |
HasImplicitCast(Type, Type)
Determines if an implicit casting operator exists from one type to another.
Declaration
public static bool HasImplicitCast(Type fromType, Type toType)
Parameters
Type | Name | Description |
---|---|---|
Type | fromType | The parameter type of the implicit casting operator. |
Type | toType | The return type fo the implicit casting operator. |
Returns
Type | Description |
---|---|
System.Boolean | True if the implicit casting operator exists or false if not. |
HasImplicitCast<TFrom, TTo>()
Determines if an implicit casting operator exists from one type to another.
Declaration
public static bool HasImplicitCast<TFrom, TTo>()
Returns
Type | Description |
---|---|
System.Boolean | True if the implicit casting operator exists or false if not. |
Type Parameters
Name | Description |
---|---|
TFrom | The parameter type of the implicit casting operator. |
TTo | The return type fo the implicit casting operator. |
IsLocalFunction(MethodBase)
Determines if a method is a local function.
Declaration
public static bool IsLocalFunction(this MethodBase methodBase)
Parameters
Type | Name | Description |
---|---|---|
MethodBase | methodBase | The method to determine if it is a local function. |
Returns
Type | Description |
---|---|
System.Boolean | True if the method is a local function. False if not. |
LoadXmlDocumentation(String)
Loads the XML code documentation into memory so it can be accessed by extension methods on reflection types.
Declaration
public static void LoadXmlDocumentation(string xmlDocumentation)
Parameters
Type | Name | Description |
---|---|---|
System.String | xmlDocumentation | The content of the XML code documentation. |
LoadXmlDocumentation(TextReader)
Loads the XML code documentation into memory so it can be accessed by extension methods on reflection types.
Declaration
public static void LoadXmlDocumentation(TextReader textReader)
Parameters
Type | Name | Description |
---|---|---|
TextReader | textReader | The text reader to process in an XmlReader. |