Export (0) Print
Expand All

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)

'Declaration
Public Function ToString ( _
	fieldCount As Integer _
) As String

Parameters

fieldCount
Type: System.Int32

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

Return Value

Type: System.String
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.

fieldCount

Return Value

0

An empty string ("").

1

major

2

major.minor

3

major.minor.build

4

major.minor.build.revision

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.

ExceptionCondition
ArgumentException

fieldCount is less than 0, or more than 4.

-or-

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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft