Mono Class Library: System.Version Overview | MembersSystem.Version Constructor |
Constructs and initializes a new instance of the Version class using the values represented by the specified string. [Edit]
|
- version
A string that represents 2 to 4 int integers separated by period characters ('.'). Each component delineated by a period character will be parsed to a int with int.Parse(string)(string). The numbers will be processed in the following order: major, minor, build, revision. If the revision or the revision and the build components are not represented by version, their values will be undefined.
Note:[Edit]The formatting of version must be as follows, with optional components shown in square brackets ('[' and']'): major.minor[.build[.revision]], where each component returns a int with int.Parse(string) (string).
Type Reason ArgumentException version has fewer than 2 components or more than 4 components (i.e. fewer than 1 or more than 3 period characters). [Edit] ArgumentNullException version is a null reference. [Edit] ArgumentOutOfRangeException major, minor, build, or revision is less than zero. [Edit] FormatException At least one component of version does not parse to a int with int.Parse(string) (string). [Edit]
Documentation for this section has not yet been entered. [Edit]
The following example sets the version to "6.1.2.4" and writes the result to the console.
C# Example using System; public class Vers { public static void Main() { Version vers = new Version( "6.1.2.4" ); Console.WriteLine( "Version is {0}", vers.ToString() ); } }The output is
Version is 6.1.2.4
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0