C# Class NetFx.StringlyTyped.Stringly

Utilities for rendering .NET types as C# type names, with support for generics, nested types, type name simplification via "using" scopes, etc.
Afficher le fichier Open project: netfx/extensions Class Usage Examples

Méthodes publiques

Méthode Description
BeginScope ( ) : IStringlyScope

Creates a new stringly scope, which can be used to register types that will be used as strings, so that safe code imports can be determined and type names can be shortened to the safest form.

The scope takes into account all type names in use, and determines what namespaces can be safely removed from certain type names without introducing ambiguities.

ToTypeFullName ( this type ) : string

Gets the C# name for the type, including proper rendering of generics, using full names of types.

For example, for a generic enumerable of boolean, which has a full name of System.Collections.Generic.IEnumerable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], this method returns System.Collections.Generic.IEnumerable<System.Boolean>.

ToTypeName ( this type ) : string

Gets the C# name for the type, including proper rendering of generics, using the simple name of types.

For example, for a generic enumerable of boolean, which has a full name of System.Collections.Generic.IEnumerable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], this method returns IEnumerable<Boolean>.

Private Methods

Méthode Description
GetTypeFullName ( Type type ) : string
ToTypeFullName ( this type, Queue genericArguments ) : string
ToTypeName ( this type, Queue genericArguments ) : string

Method Details

BeginScope() public static méthode

Creates a new stringly scope, which can be used to register types that will be used as strings, so that safe code imports can be determined and type names can be shortened to the safest form.
The scope takes into account all type names in use, and determines what namespaces can be safely removed from certain type names without introducing ambiguities.
public static BeginScope ( ) : IStringlyScope
Résultat IStringlyScope

ToTypeFullName() public static méthode

Gets the C# name for the type, including proper rendering of generics, using full names of types.
For example, for a generic enumerable of boolean, which has a full name of System.Collections.Generic.IEnumerable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], this method returns System.Collections.Generic.IEnumerable<System.Boolean>.
public static ToTypeFullName ( this type ) : string
type this The type to convert to a C# full type name.
Résultat string

ToTypeName() public static méthode

Gets the C# name for the type, including proper rendering of generics, using the simple name of types.
For example, for a generic enumerable of boolean, which has a full name of System.Collections.Generic.IEnumerable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], this method returns IEnumerable<Boolean>.
public static ToTypeName ( this type ) : string
type this The type to convert to a simple C# type name.
Résultat string