Table of Contents

Class ConvertTypeShortcutFullName

Namespace
SunamoConverters.Converts
Assembly
SunamoConverters.dll

Converts between C# type shortcuts (e.g., "string", "int") and their full System type names (e.g., "System.String", "System.Int32").

public static class ConvertTypeShortcutFullName
Inheritance
ConvertTypeShortcutFullName
Inherited Members

Methods

FromShortcut(string)

Converts a C# type shortcut (e.g., "string", "int") to its full name (e.g., "System.String", "System.Int32").

public static string FromShortcut(string shortcut)

Parameters

shortcut string

The type shortcut.

Returns

string

The full type name.

Exceptions

Exception

Thrown when the shortcut is not a supported keyword.

ToShortcut(object)

Converts an object instance to its type shortcut.

public static string ToShortcut(object instance)

Parameters

instance object

The object instance.

Returns

string

The type shortcut.

ToShortcut(string)

Converts a full type name to its C# shortcut.

public static string ToShortcut(string fullName)

Parameters

fullName string

The full type name (e.g., "System.String").

Returns

string

The type shortcut (e.g., "string").

ToShortcut(string, bool)

Converts a full type name to its C# shortcut.

public static string ToShortcut(string fullName, bool isThrowingExceptionWhenNotBasicType)

Parameters

fullName string

The full type name (e.g., "System.String" or "String").

isThrowingExceptionWhenNotBasicType bool

If true, throws an exception for non-basic types; otherwise returns the full name.

Returns

string

The type shortcut or the original full name.

Exceptions

Exception

Thrown when the type is not a basic type and isThrowingExceptionWhenNotBasicType is true.