Version::Parse Method

Converts the string representation of a version number to an equivalent Version object.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

static Version^ Parse(
	String^ input


Type: System::String

A string that contains a version number to convert.

Return Value

Type: System::Version
An object that is equivalent to the version number specified in the input parameter.


input is nullptr.


input has fewer than two or more than four version components.


At least one component in input is less than zero.


At least one component in input is not an integer.


At least one component in input represents a number that is greater than Int32::MaxValue.

The input parameter must have the following format:


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 noteImportant

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.

The following example uses the Parse method to parse a number of strings that contain version information.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft