SemanticVersion Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
An implementation of semantic versioning (https://semver.org) that can be converted to/from Version.
When converting to Version, a PSNoteProperty is added to the instance to store the semantic version label so that it can be recovered when creating a new SemanticVersion.
public ref class SemanticVersion sealed : IComparable, IComparable<System::Management::Automation::SemanticVersion ^>, IEquatable<System::Management::Automation::SemanticVersion ^>
public sealed class SemanticVersion : IComparable, IComparable<System.Management.Automation.SemanticVersion>, IEquatable<System.Management.Automation.SemanticVersion>
type SemanticVersion = class
interface IComparable
interface IComparable<SemanticVersion>
interface IEquatable<SemanticVersion>
Public NotInheritable Class SemanticVersion
Implements IComparable, IComparable(Of SemanticVersion), IEquatable(Of SemanticVersion)
- Inheritance
-
SemanticVersion
- Implements
Constructors
SemanticVersion(Int32, Int32, Int32, String, String) |
Construct a SemanticVersion. |
SemanticVersion(Int32, Int32, Int32, String) | |
SemanticVersion(Int32, Int32, Int32) |
Construct a SemanticVersion. |
SemanticVersion(Int32, Int32) |
Construct a SemanticVersion. |
SemanticVersion(Int32) |
Construct a SemanticVersion. |
SemanticVersion(String) |
Construct a SemanticVersion from a string. |
SemanticVersion(Version) |
Construct a SemanticVersion from a Version, copying the NoteProperty storing the label if the expected property exists. |
Properties
BuildLabel |
BuildLabel position in the SymVer string 'major.minor.patch-PreReleaseLabel+BuildLabel'. |
Major |
The major version number, never negative. |
Minor |
The minor version number, never negative. |
Patch |
The patch version, -1 if not specified. |
PreReleaseLabel |
PreReleaseLabel position in the SymVer string 'major.minor.patch-PreReleaseLabel+BuildLabel'. |
Methods
Compare(SemanticVersion, SemanticVersion) |
Implement Compare. |
CompareTo(Object) |
Implement CompareTo(Object) |
CompareTo(SemanticVersion) |
Implement CompareTo(T). Meets SymVer 2.0 p.11 https://semver.org/ |
Equals(Object) |
Override Equals(Object) |
Equals(SemanticVersion) |
Implement Equals(T) |
GetHashCode() |
Override GetHashCode() |
Parse(String) |
Parse |
ToString() |
Implement ToString() |
TryParse(String, SemanticVersion) |
Parse |
Operators
Equality(SemanticVersion, SemanticVersion) |
Overloaded == operator. |
GreaterThan(SemanticVersion, SemanticVersion) |
Overloaded > operator. |
GreaterThanOrEqual(SemanticVersion, SemanticVersion) |
Overloaded >= operator. |
Implicit(SemanticVersion to Version) |
Convert a SemanticVersion to a Version. If there is a PreReleaseLabel or/and a BuildLabel, it is added as a NoteProperty to the result so that you can round trip back to a SemanticVersion without losing the label. |
Inequality(SemanticVersion, SemanticVersion) |
Overloaded != operator. |
LessThan(SemanticVersion, SemanticVersion) |
Overloaded < operator. |
LessThanOrEqual(SemanticVersion, SemanticVersion) |
Overloaded <= operator. |