Show / Hide Table of Contents

Class Meta

Constains static analysis methods of the code (reflection).

Inheritance
System.Object
Meta
Namespace: Towel
Assembly: Towel.dll
Syntax
public static class Meta : object

Methods

| Improve this Doc View Source

ClearXmlDocumentation()

Clears the currently loaded XML documentation.

Declaration
public static void ClearXmlDocumentation()
| Improve this Doc View Source

ConvertToCSharpSource(Type, Boolean)

Converts a into a as it would appear in C# source code.

Declaration
public static string ConvertToCSharpSource(this Type type, bool showGenericParameters = false)
Parameters
Type Name Description
Type type

The to convert to a .

System.Boolean showGenericParameters

If the generic parameters are the generic types, whether they should be shown or not.

Returns
Type Description
System.String

The as the would appear in C# source code.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

GetFactorialMethod(Type)

Gets the Factorial on a type if it exists [ 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 if found or null if not.

| Improve this Doc View Source

GetFactorialMethod<T>()

Gets the Factorial on a type if it exists [ Factorial(T)].

Declaration
public static MethodInfo? GetFactorialMethod<T>()
Returns
Type Description
System.Nullable<MethodInfo>

The IsPrime if found or null if not.

Type Parameters
Name Description
T

The type of the out parameter.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

GetIsEvenMethod(Type)

Gets the IsEven on a type if it exists [ 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 if found or null if not.

| Improve this Doc View Source

GetIsEvenMethod<T>()

Gets the IsEven on a type if it exists [ IsEven(T)].

Declaration
public static MethodInfo? GetIsEvenMethod<T>()
Returns
Type Description
System.Nullable<MethodInfo>

The IsEven if found or null if not.

Type Parameters
Name Description
T

The type of the out parameter.

| Improve this Doc View Source

GetIsIntegerMethod(Type)

Gets the IsInteger on a type if it exists [ 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 if found or null if not.

| Improve this Doc View Source

GetIsIntegerMethod<T>()

Gets the IsInteger on a type if it exists [ IsInteger(T)].

Declaration
public static MethodInfo? GetIsIntegerMethod<T>()
Returns
Type Description
System.Nullable<MethodInfo>

The TryParse if found or null if not.

Type Parameters
Name Description
T

The type of the out parameter.

| Improve this Doc View Source

GetIsNegativeMethod(Type)

Gets the IsNegative on a type if it exists [ 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 if found or null if not.

| Improve this Doc View Source

GetIsNegativeMethod<T>()

Gets the IsNegative on a type if it exists [ IsNegative(T)].

Declaration
public static MethodInfo? GetIsNegativeMethod<T>()
Returns
Type Description
System.Nullable<MethodInfo>

The IsNegative if found or null if not.

Type Parameters
Name Description
T

The type of the out parameter.

| Improve this Doc View Source

GetIsNonNegativeMethod(Type)

Gets the IsNonNegative on a type if it exists [ 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 if found or null if not.

| Improve this Doc View Source

GetIsNonNegativeMethod<T>()

Gets the IsNonNegative on a type if it exists [ IsNonNegative(T)].

Declaration
public static MethodInfo? GetIsNonNegativeMethod<T>()
Returns
Type Description
System.Nullable<MethodInfo>

The IsNonNegative if found or null if not.

Type Parameters
Name Description
T

The type of the out parameter.

| Improve this Doc View Source

GetIsOddMethod(Type)

Gets the IsOdd on a type if it exists [ 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 if found or null if not.

| Improve this Doc View Source

GetIsOddMethod<T>()

Gets the IsOdd on a type if it exists [ IsOdd(T)].

Declaration
public static MethodInfo? GetIsOddMethod<T>()
Returns
Type Description
System.Nullable<MethodInfo>

The IsOdd if found or null if not.

Type Parameters
Name Description
T

The type of the out parameter.

| Improve this Doc View Source

GetIsPositiveMethod(Type)

Gets the IsPositive on a type if it exists [ 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 if found or null if not.

| Improve this Doc View Source

GetIsPositiveMethod<T>()

Gets the IsPositive on a type if it exists [ IsPositive(T)].

Declaration
public static MethodInfo? GetIsPositiveMethod<T>()
Returns
Type Description
System.Nullable<MethodInfo>

The IsPositive if found or null if not.

Type Parameters
Name Description
T

The type of the out parameter.

| Improve this Doc View Source

GetIsPrimeMethod(Type)

Gets the IsPrime on a type if it exists [ 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 if found or null if not.

| Improve this Doc View Source

GetIsPrimeMethod<T>()

Gets the IsPrime on a type if it exists [ IsPrime(T)].

Declaration
public static MethodInfo? GetIsPrimeMethod<T>()
Returns
Type Description
System.Nullable<MethodInfo>

The IsPrime if found or null if not.

Type Parameters
Name Description
T

The type of the out parameter.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

GetTryParseMethod(Type)

Gets the TryParse on a type if it exists [ TryParse(, out 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 if found or null if not.

| Improve this Doc View Source

GetTryParseMethod<T>()

Gets the TryParse on a type if it exists [ TryParse(, out T)].

Declaration
public static MethodInfo? GetTryParseMethod<T>()
Returns
Type Description
System.Nullable<MethodInfo>

The TryParse if found or null if not.

Type Parameters
Name Description
T

The type of the out parameter.

| Improve this Doc View Source

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.

| Improve this Doc View Source

GetXmlName(ConstructorInfo)

Gets the XML name of an as it appears in the XML docs.

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 constructorInfo as it appears in the XML docs.

| Improve this Doc View Source

GetXmlName(EventInfo)

Gets the XML name of an as it appears in the XML docs.

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 eventInfo as it appears in the XML docs.

| Improve this Doc View Source

GetXmlName(FieldInfo)

Gets the XML name of an as it appears in the XML docs.

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 fieldInfo as it appears in the XML docs.

| Improve this Doc View Source

GetXmlName(MethodInfo)

Gets the XML name of an as it appears in the XML docs.

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 methodInfo as it appears in the XML docs.

| Improve this Doc View Source

GetXmlName(PropertyInfo)

Gets the XML name of an as it appears in the XML docs.

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 propertyInfo as it appears in the XML docs.

| Improve this Doc View Source

GetXmlName(Type)

Gets the XML name of an as it appears in the XML docs.

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 type as it appears in the XML docs.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX