C# Class Octopus.Client.Model.Versioning.VersionComparer

An IVersionComparer for NuGetVersion and NuGetVersion types.
Inheritance: IVersionComparer
Mostra file Open project: OctopusDeploy/Octo.exe Class Usage Examples

Public Properties

Property Type Description
Default IVersionComparer
Version IVersionComparer
VersionRelease IVersionComparer
VersionReleaseMetadata IVersionComparer

Public Methods

Method Description
Compare ( StrictSemanticVersion x, StrictSemanticVersion y ) : int

Compare versions.

Compare ( StrictSemanticVersion version1, StrictSemanticVersion version2, VersionComparison versionComparison ) : int

Compares the given versions using the VersionComparison mode.

Equals ( StrictSemanticVersion x, StrictSemanticVersion y ) : bool

Determines if both versions are equal.

GetHashCode ( StrictSemanticVersion version ) : int

Gives a hash code based on the normalized version string.

VersionComparer ( ) : System

Creates a VersionComparer using the default mode.

VersionComparer ( VersionComparison versionComparison ) : System

Creates a VersionComparer that respects the given comparison mode.

Private Methods

Method Description
CompareLegacyVersion ( SemanticVersion legacyX, SemanticVersion legacyY ) : int

Compares the 4th digit of the version number.

CompareRelease ( string version1, string version2 ) : int

Release labels are compared as numbers if they are numeric, otherwise they will be compared as strings.

CompareReleaseLabels ( IEnumerable version1, IEnumerable version2 ) : int

Compares sets of release labels.

Method Details

Compare() public method

Compare versions.
public Compare ( StrictSemanticVersion x, StrictSemanticVersion y ) : int
x StrictSemanticVersion
y StrictSemanticVersion
return int

Compare() public static method

Compares the given versions using the VersionComparison mode.
public static Compare ( StrictSemanticVersion version1, StrictSemanticVersion version2, VersionComparison versionComparison ) : int
version1 StrictSemanticVersion
version2 StrictSemanticVersion
versionComparison VersionComparison
return int

Equals() public method

Determines if both versions are equal.
public Equals ( StrictSemanticVersion x, StrictSemanticVersion y ) : bool
x StrictSemanticVersion
y StrictSemanticVersion
return bool

GetHashCode() public method

Gives a hash code based on the normalized version string.
public GetHashCode ( StrictSemanticVersion version ) : int
version StrictSemanticVersion
return int

VersionComparer() public method

Creates a VersionComparer using the default mode.
public VersionComparer ( ) : System
return System

VersionComparer() public method

Creates a VersionComparer that respects the given comparison mode.
public VersionComparer ( VersionComparison versionComparison ) : System
versionComparison VersionComparison comparison mode
return System

Property Details

Default public_oe static_oe property

A default comparer that compares metadata as strings.
public static IVersionComparer Default
return IVersionComparer

Version public_oe static_oe property

A comparer that uses only the version numbers.
public static IVersionComparer Version
return IVersionComparer

VersionRelease public_oe static_oe property

Compares versions without comparing the metadata.
public static IVersionComparer VersionRelease
return IVersionComparer

VersionReleaseMetadata public_oe static_oe property

A version comparer that follows SemVer 2.0.0 rules.
public static IVersionComparer VersionReleaseMetadata
return IVersionComparer