C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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>.

Приватные методы

Метод Описание
GetTypeFullName ( Type type ) : string
ToTypeFullName ( this type, Queue genericArguments ) : string
ToTypeName ( this type, Queue genericArguments ) : string

Описание методов

BeginScope() публичный статический Метод

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
Результат IStringlyScope

ToTypeFullName() публичный статический Метод

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.
Результат string

ToTypeName() публичный статический Метод

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.
Результат string