Version.ToString Method

Definition

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

Overloads

ToString()

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

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()

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

ToString(Int32)

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