Table of Contents

Class SemanticVersion

Namespace
MongoDB.Driver.Core.Misc
Assembly
MongoDB.Driver.Core.dll

Represents a semantic version number.

public class SemanticVersion : IEquatable<SemanticVersion>, IComparable<SemanticVersion>
Inheritance
SemanticVersion
Implements
Inherited Members

Constructors

SemanticVersion(int, int, int)

Initializes a new instance of the SemanticVersion class.

public SemanticVersion(int major, int minor, int patch)

Parameters

major int

The major version.

minor int

The minor version.

patch int

The patch version.

SemanticVersion(int, int, int, string)

Initializes a new instance of the SemanticVersion class.

public SemanticVersion(int major, int minor, int patch, string preRelease)

Parameters

major int

The major version.

minor int

The minor version.

patch int

The patch version.

preRelease string

The pre release version.

Properties

Major

Gets the major version.

public int Major { get; }

Property Value

int

The major version.

Minor

Gets the minor version.

public int Minor { get; }

Property Value

int

The minor version.

Patch

Gets the patch version.

public int Patch { get; }

Property Value

int

The patch version.

PreRelease

Gets the pre release version.

public string PreRelease { get; }

Property Value

string

The pre release version.

Methods

CompareTo(SemanticVersion)

public int CompareTo(SemanticVersion other)

Parameters

other SemanticVersion

Returns

int

Equals(SemanticVersion)

public bool Equals(SemanticVersion other)

Parameters

other SemanticVersion

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Parse(string)

Parses a string representation of a semantic version.

public static SemanticVersion Parse(string value)

Parameters

value string

The string value to parse.

Returns

SemanticVersion

A semantic version.

ToString()

public override string ToString()

Returns

string

TryParse(string, out SemanticVersion)

Tries to parse a string representation of a semantic version.

public static bool TryParse(string value, out SemanticVersion result)

Parameters

value string

The string value to parse.

result SemanticVersion

The result.

Returns

bool

True if the string representation was parsed successfully; otherwise false.

Operators

operator ==(SemanticVersion, SemanticVersion)

Determines whether two specified semantic versions have the same value.

public static bool operator ==(SemanticVersion a, SemanticVersion b)

Parameters

a SemanticVersion

The first semantic version to compare, or null.

b SemanticVersion

The second semantic version to compare, or null.

Returns

bool

True if the value of a is the same as the value of b; otherwise false.

operator >(SemanticVersion, SemanticVersion)

Determines whether the first specified SemanticVersion is greater than the second specified SemanticVersion.

public static bool operator >(SemanticVersion a, SemanticVersion b)

Parameters

a SemanticVersion

The first semantic version to compare, or null.

b SemanticVersion

The second semantic version to compare, or null.

Returns

bool

True if the value of a is greater than b; otherwise false.

operator >=(SemanticVersion, SemanticVersion)

Determines whether the first specified SemanticVersion is greater than or equal to the second specified SemanticVersion.

public static bool operator >=(SemanticVersion a, SemanticVersion b)

Parameters

a SemanticVersion

The first semantic version to compare, or null.

b SemanticVersion

The second semantic version to compare, or null.

Returns

bool

True if the value of a is greater than or equal to b; otherwise false.

operator !=(SemanticVersion, SemanticVersion)

Determines whether two specified semantic versions have different values.

public static bool operator !=(SemanticVersion a, SemanticVersion b)

Parameters

a SemanticVersion

The first semantic version to compare, or null.

b SemanticVersion

The second semantic version to compare, or null.

Returns

bool

True if the value of a is different from the value of b; otherwise false.

operator <(SemanticVersion, SemanticVersion)

Determines whether the first specified SemanticVersion is less than the second specified SemanticVersion.

public static bool operator <(SemanticVersion a, SemanticVersion b)

Parameters

a SemanticVersion

The first semantic version to compare, or null.

b SemanticVersion

The second semantic version to compare, or null.

Returns

bool

True if the value of a is less than b; otherwise false.

operator <=(SemanticVersion, SemanticVersion)

Determines whether the first specified SemanticVersion is less than or equal to the second specified SemanticVersion.

public static bool operator <=(SemanticVersion a, SemanticVersion b)

Parameters

a SemanticVersion

The first semantic version to compare, or null.

b SemanticVersion

The second semantic version to compare, or null.

Returns

bool

True if the value of a is less than or equal to b; otherwise false.