ToString Method


Returns a string that represents the current object.

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

public virtual string ToString()

Return Value

Type: System..::..String
A string that represents the current object.

ToString is the major formatting method in the .NET Framework. It converts an object to its string representation so that it is suitable for display.

The default implementation of the ToString method returns the fully qualified name of the type of the Object.

Because Object is the base class of all reference types in the .NET Framework, this behavior is inherited by reference types that do not override the ToString method.

Types commonly override the ToString method to return a string that represents the object instance. For example, the base types such as Char, Int32, and String provide ToString implementations that return the string form of the value that the object represents.