C# Version Parse
Description
Version Parse
converts the string representation of
a version number to an equivalent Version object.
Syntax
Version.Parse
has the following syntax.
public static Version Parse(
string input
)
Parameters
Version.Parse
has the following parameters.
input
- A string that contains a version number to convert.
Returns
Version.Parse
method returns An object that is equivalent to the version number specified in the input
parameter.
Example
The following example uses the Parse method to parse a number of strings that contain version information.
//from w ww . j a va 2s . c o m
using System;
public class Example
{
public static void Main()
{
string input = "4.0";
Version ver = Version.Parse(input);
Console.WriteLine(ver);
input = "4.0.";
ver = Version.Parse(input);
Console.WriteLine(ver);
input = "1.1.2";
ver = Version.Parse(input);
Console.WriteLine(ver);
}
}
The code above generates the following result.