Summary
Represents a semantic version with optional pre-release tag and
build metadata.
- Namespace
- GitVersion
- Interfaces
-
-
IComparable
<SemanticVersion> -
IEquatable
<SemanticVersion>
-
IComparable
- Base Types
-
- IFormattable
graph BT Type-->Base0["IFormattable"]
Type-.->Interface0["IComparable<SemanticVersion>"]
Type-.->Interface1["IEquatable<SemanticVersion>"]
Type["SemanticVersion"] class Type type-node
Syntax
public sealed class SemanticVersion : IFormattable, IComparable<SemanticVersion>,
IEquatable<SemanticVersion>
Constructors
| Name | Summary |
|---|---|
|
SemanticVersion |
Initializes a new semantic version with the given major, minor, and patch values. |
|
SemanticVersion |
Initializes a new semantic version as a copy of semanticVersion. |
Fields
| Name | Constant Value | Summary |
|---|---|---|
| Empty |
A zero-valued semantic version with no pre-release tag
or build metadata.
static
|
Properties
| Name | Value | Summary |
|---|---|---|
| BuildMetaData |
Semantic |
Gets or initializes the build metadata associated with
this version.
|
| IsPreRelease | bool |
Gets a value indicating whether this version has a
pre-release tag.
|
| Major | long |
Gets or initializes the major version component.
|
| Minor | long |
Gets or initializes the minor version component.
|
| Patch | long |
Gets or initializes the patch version component.
|
| PreReleaseTag |
Semantic |
Gets or initializes the pre-release tag.
|
Methods
| Name | Value | Summary |
|---|---|---|
|
CompareTo |
int |
Compares this version to
value,
optionally excluding the pre-release tag from the
comparison.
|
|
CompareTo |
int |
Compares this version to
value,
including the pre-release tag in the comparison.
|
|
Equals |
bool | |
|
Equals |
bool |
Returns
true when this version
is equal to
obj.
|
|
GetHashCode |
int |
Returns a hash code combining all version components.
|
|
Increment |
SemanticVersion |
Returns a new version incremented by
increment
with the given
label,
optionally forcing the increment.
|
|
Increment |
SemanticVersion |
Returns a new version incremented by
increment
with the given
label and
increment
mode.
|
|
Increment |
SemanticVersion |
Returns a new version incremented by
increment
with the given
label.
|
|
IsEmpty |
bool |
Returns
true when this instance
equals
Empty.
|
|
IsEqualTo |
bool |
Returns
true when this version
is equal to
value.
|
|
IsGreaterThan |
bool |
Returns
true when this version
is greater than
value.
|
|
Is |
bool |
Returns
true when this version
is greater than or equal to
value.
|
|
IsLabeledWith |
bool |
Returns
true when the
pre-release tag name equals
value
(case-insensitive).
|
|
IsLessThan |
bool |
Returns
true when this version
is less than
value.
|
|
IsLessThanOrEqualTo |
bool |
Returns
true when this version
is less than or equal to
value.
|
|
Is |
bool |
Returns
true when this version
is compatible with a branch-specific label check: no tag
set, no label supplied, or the label matches.
|
|
Parse |
SemanticVersion |
Parses
version as
a semantic version, throwing when the input cannot be
parsed.
static
|
|
ToString |
string |
Returns the default semantic version string (without
build metadata).
|
|
ToString |
string |
s - Default SemVer [1.2.3-beta.4] f - Full SemVer [1.2.3-beta.4+5] i - Informational SemVer [1.2.3-beta.4+5.Branch.main.BranchType.main.Sha.000000] j - Just the SemVer part [1.2.3] t - SemVer with the tag [1.2.3-beta.4] |
|
ToString |
string |
Returns a string representation of this version using
the given format specifier.
|
|
TryParse |
bool |
Attempts to parse
version as
a semantic version, returning
true on success.
static
|
|
WithLabel |
SemanticVersion |
Returns a new version derived from this one with the
pre-release tag changed to
label.
|
Operators
| Name | Value | Summary |
|---|---|---|
|
operator != |
bool | |
|
operator |
bool | |
|
operator |
bool | |
|
operator == |
bool | |
|
operator > |
bool | |
|
operator > |
bool |
Extension Methods
| Name | Value | Summary |
|---|---|---|
|
NotNull |
T |
Throws
ArgumentNullException when
value is
null; otherwise returns the
value.
From
CommonExtensions
|