Type.ToString Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Returns a String representing the name of the current Type.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

override ToString : unit -> string

Return Value

Type: System.String

A String representing the name of the current Type.

This method returns the fully qualified common language runtime namespace and name for all primitive types. For example, the C# instruction, (long)0.Type().ToString() returns "System.Int64" instead of merely "Int64".

If the current Type represents a generic type, the type and its type arguments are qualified by namespace and by nested type, but not by assembly. If the current Type represents a type parameter in the definition of a generic type or generic method, this method returns the unqualified name of the type parameter.

This following example demonstrates a use of the Namespace and Module properties and the ToString method of Type.

No code example is currently available or this language may not be supported.

The following example compares the strings returned by the ToString method and the Name, FullName, and AssemblyQualifiedName properties.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: