C# Version ToString(Int32)
Description
Version 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.
Syntax
Version.ToString(Int32)
has the following syntax.
public string ToString(
int fieldCount
)
Parameters
Version.ToString(Int32)
has the following parameters.
fieldCount
- The number of components to return. The fieldCount ranges from 0 to 4.
Returns
Version.ToString(Int32)
method 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
('.').
Example
//from w ww.j ava 2s . com
using System;
public class Example
{
public static void Main()
{
string input = "4.0.1.2";
Version ver = Version.Parse(input);
Console.WriteLine(ver.ToString(1));
}
}
The code above generates the following result.