Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Version.ToString Method

Definition

Namespace:
System
Assemblies:
mscorlib.dll, System.Runtime.dll
Assemblies:
netstandard.dll, System.Runtime.dll
Assembly:
System.Runtime.dll
Assembly:
mscorlib.dll
Assembly:
netstandard.dll

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Converts the value of the current Version object to its equivalent String representation.

Overloads

Name Description
ToString(Int32)

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

ToString()

Converts the value of the current Version object to its equivalent String representation.

ToString(Int32)

Source:
Version.cs
Source:
Version.cs
Source:
Version.cs
Source:
Version.cs
Source:
Version.cs

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

public:
 System::String ^ ToString(int fieldCount);
public string ToString(int fieldCount);
override this.ToString : int -> string
Public Function ToString (fieldCount As Integer) As String

Parameters

fieldCount
Int32

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

Returns

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.

Exceptions

fieldCount is less than 0, or more than 4.

-or-

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

Applies to

ToString()

Source:
Version.cs
Source:
Version.cs
Source:
Version.cs
Source:
Version.cs
Source:
Version.cs

Converts the value of the current Version object to its equivalent String representation.

public:
 override System::String ^ ToString();
public override string ToString();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

Returns

The String representation of the values of the major, minor, build, and revision components of the current Version object, as depicted in the following format. Each component is separated by a period character ('.'). Square brackets ('[' and ']') indicate a component that will not appear in the return value if the component is not defined:

major.minor[.build[.revision]]

For example, if you create a Version object using the constructor Version(1,1), the returned string is "1.1". If you create a Version object using the constructor Version(1,3,4,2), the returned string is "1.3.4.2".

Applies to


Feedback

Was this page helpful?