ToString Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Returns a string that represents the current object.

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

Syntax

'Declaration
Public Overridable Function ToString As String
public virtual string ToString()
public:
virtual String^ ToString()
abstract ToString : unit -> string 
override ToString : unit -> string 
public function ToString() : String

Return Value

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

Remarks

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.

.NET Framework Security

See Also

Reference

Object Class

System Namespace