Namespace:
System
Assembly:
mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
Public Overridable Function ToString As String
Dim instance As Object
Dim returnValue As String
returnValue = instance.ToString()
public virtual string ToString()
This method returns a human-readable string that is culture-sensitive. For example, for an instance of the Double class whose value is zero, the implementation of Double..::.ToString might return "0.00" or "0,00" depending on the current UI culture.
The default implementation returns the fully qualified name of the type of the Object.
Notes to Implementers: This method can be overridden in a derived class to return values that are meaningful for that type. For example, the base data types, such as Int32, implement ToString so that it returns the string form of the value that the object represents. Derived classes that require more control over the formatting of strings than ToString provides must implement IFormattable, whose ToString method uses the current thread's CurrentCulture property.
The following code example demonstrates what ToString returns.
Public Class Example
Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
' Displays: "System.Object"
Dim o As New Object()
outputBlock.Text &= o.ToString() & vbCrLf
End Sub
End Class
using System;
public class Example
{
public static void Demo(System.Windows.Controls.TextBlock outputBlock)
{
// Prints out: "System.Object"
Object o = new Object();
outputBlock.Text += o.ToString() + "\n";
}
}
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Reference