Version::Parse Method
Converts the string representation of a version number to an equivalent Version object.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- input
- Type: System::String
A string that contains a version number to convert.
Return Value
Type: System::VersionAn object that is equivalent to the version number specified in the input parameter.
| Exception | Condition |
|---|---|
| ArgumentNullException | input is nullptr. |
| ArgumentException | input has fewer than two or more than four version components. |
| ArgumentOutOfRangeException | At least one component in input is less than zero. |
| FormatException | At least one component in input is not an integer. |
| OverflowException | At least one component in input represents a number that is greater than Int32::MaxValue. |
The input parameter must have the following format:
major.minor[.build[.revision]]
where major, minor, build, and revision are the string representations of the version number's four components: major version number, minor version number, build number, and revision number. Optional components are shown in square brackets ([ and ]). The components must appear in the specified order, and must be separated by periods.
Important |
|---|
Because the string representation of a version number must conform to a recognized pattern, applications should always use exception handling when calling the Parse method to parse user input. Alternatively, you can call the TryParse method to parse the string representation of a version number and return a value that indicates whether the parse operation succeeded. |
The Parse method is a convenience method; it is equivalent to calling the Version(String) constructor.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Important