C# Class Reinforced.Typings.TypeExtensions

Useful extensions for reflection
Mostra file Open project: reinforced/Reinforced.Typings

Public Properties

Property Type Description
TypeScriptMemberSearchPredicate bool>.Func

Public Methods

Method Description
GetArg ( this t ) : Type

Retrieves first type argument of type

GetExportedFields ( this t ) : System.Reflection.FieldInfo[]

Returns all fields that should be exported to TypeScript for specified type

GetExportedMethods ( this t ) : System.Reflection.MethodInfo[]

Returns all methods that should be exported to TypeScript for specified type

GetExportedProperties ( this t ) : System.Reflection.PropertyInfo[]

Returns all properties that should be exported to TypeScript for specified type

GetModifier ( this fieldInfo ) : AccessModifier

Returns access modifier for specified field

GetName ( this t, RtTypeName genericArguments = null ) : RtSimpleTypeName

Retrieves type name from type itself or from corresponding Reinforced.Typings attribute

GetName ( this element ) : string

Retrieves parameter name from corresponding attribute. If attribute not present then takes parameter name via reflection

GetNamespace ( this t, bool distinguishAutoTypes = false ) : string

Retrieves type namespace from type itself or from corresponding Typings attribute

IsBounceProperty ( this propertyInfo ) : bool

Determines if propercy is "bounced". It means property with different accesor's access level

IsDelegate ( this t ) : bool

Determines if supplied type is delegate type

IsDictionary ( this t ) : bool

Determines if type is Dictionary-like

IsEnumerable ( this t ) : bool

Determines if type is enumerable regardless of generic spec

IsExportingAsClass ( this t ) : bool

Determines should type be exported as class or not

IsExportingAsInterface ( this t ) : bool

Determines should type be exported as interface or not

IsIgnored ( this t ) : bool

Determines if type member should be ignored for translation using corresponding Typings attribute

IsNongenericEnumerable ( this t ) : bool

Determines if supplied type is non-generic enumerable

IsNullable ( this t ) : bool

Determines is type derived from Nullable or not

IsStatic ( this t ) : bool

Determines is type is static

ToModifierOmitPublic ( this modifier ) : string

Converts AccessModifier to corresponding TypeScript source text

ToModifierText ( this modifier ) : string

Converts AccessModifier to corresponding TypeScript source text

Private Methods

Method Description
CleanGenericName ( this t ) : string

Removes generics postfix (all text after '`') from typename

GetMethodWithSameParameters ( MethodBase methodsSet, Type parameters ) : MethodBase
SerializeGenericArguments ( this t ) : RtTypeName[]

Method Details

GetArg() public static method

Retrieves first type argument of type
public static GetArg ( this t ) : Type
t this Type
return System.Type

GetExportedFields() public static method

Returns all fields that should be exported to TypeScript for specified type
public static GetExportedFields ( this t ) : System.Reflection.FieldInfo[]
t this Type
return System.Reflection.FieldInfo[]

GetExportedMethods() public static method

Returns all methods that should be exported to TypeScript for specified type
public static GetExportedMethods ( this t ) : System.Reflection.MethodInfo[]
t this Type
return System.Reflection.MethodInfo[]

GetExportedProperties() public static method

Returns all properties that should be exported to TypeScript for specified type
public static GetExportedProperties ( this t ) : System.Reflection.PropertyInfo[]
t this Type
return System.Reflection.PropertyInfo[]

GetModifier() public static method

Returns access modifier for specified field
public static GetModifier ( this fieldInfo ) : AccessModifier
fieldInfo this Field
return AccessModifier

GetName() public static method

Retrieves type name from type itself or from corresponding Reinforced.Typings attribute
public static GetName ( this t, RtTypeName genericArguments = null ) : RtSimpleTypeName
t this Type
genericArguments RtTypeName Generic arguments to be substituted to type
return RtSimpleTypeName

GetName() public static method

Retrieves parameter name from corresponding attribute. If attribute not present then takes parameter name via reflection
public static GetName ( this element ) : string
element this Parameter info
return string

GetNamespace() public static method

Retrieves type namespace from type itself or from corresponding Typings attribute
public static GetNamespace ( this t, bool distinguishAutoTypes = false ) : string
t this Type
distinguishAutoTypes bool /// Forces GetNamespace to return "-" for interfaces with IncludeInterface = false and /// null for anonymous types ///
return string

IsBounceProperty() public static method

Determines if propercy is "bounced". It means property with different accesor's access level
public static IsBounceProperty ( this propertyInfo ) : bool
propertyInfo this Property
return bool

IsDelegate() public static method

Determines if supplied type is delegate type
public static IsDelegate ( this t ) : bool
t this Type
return bool

IsDictionary() public static method

Determines if type is Dictionary-like
public static IsDictionary ( this t ) : bool
t this Type
return bool

IsEnumerable() public static method

Determines if type is enumerable regardless of generic spec
public static IsEnumerable ( this t ) : bool
t this Type
return bool

IsExportingAsClass() public static method

Determines should type be exported as class or not
public static IsExportingAsClass ( this t ) : bool
t this Type
return bool

IsExportingAsInterface() public static method

Determines should type be exported as interface or not
public static IsExportingAsInterface ( this t ) : bool
t this Type
return bool

IsIgnored() public static method

Determines if type member should be ignored for translation using corresponding Typings attribute
public static IsIgnored ( this t ) : bool
t this Type member info
return bool

IsNongenericEnumerable() public static method

Determines if supplied type is non-generic enumerable
public static IsNongenericEnumerable ( this t ) : bool
t this Type
return bool

IsNullable() public static method

Determines is type derived from Nullable or not
public static IsNullable ( this t ) : bool
t this Type
return bool

IsStatic() public static method

Determines is type is static
public static IsStatic ( this t ) : bool
t this Type
return bool

ToModifierOmitPublic() public static method

Converts AccessModifier to corresponding TypeScript source text
public static ToModifierOmitPublic ( this modifier ) : string
modifier this Access modifier
return string

ToModifierText() public static method

Converts AccessModifier to corresponding TypeScript source text
public static ToModifierText ( this modifier ) : string
modifier this Access modifier
return string

Property Details

TypeScriptMemberSearchPredicate public_oe static_oe property

Search predicate to exclude ignored and compiler-generated items
public static Func TypeScriptMemberSearchPredicate
return bool>.Func