This documentation is archived and is not being maintained.

Version.ToString Method (Int32)

Converts the value of the current Version object to its equivalent String representation. A specified count indicates the number of components to return.

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

public string ToString (
	int fieldCount
public String ToString (
	int fieldCount
public function ToString (
	fieldCount : int
) : String
Not applicable.



The number of components to return. The fieldCount ranges from 0 to 4.

Return Value

The String representation of the values of the major, minor, build, and revision components of the current Version object, each separated by a period character ('.'). The fieldCount parameter determines how many components are returned.


Return Value


An empty string ("").







For example, if you create Version object using the constructor Version(1,3,5), ToString(2) returns "1.3" and ToString(4) throws an exception.

Exception typeCondition


fieldCount is less than 0, or more than 4.


fieldCount is more than the number of components defined in the current Version object.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0