Struct PrereleaseIdentifier
An individual prerelease identifier for a semantic version.
Implements
System.IComparable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
Assembly: Semver.dll
Syntax
public readonly struct PrereleaseIdentifier : IEquatable<PrereleaseIdentifier>, IComparable<PrereleaseIdentifier>, IComparable
Constructors
PrereleaseIdentifier(Int32)
Declaration
public PrereleaseIdentifier(int value)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
The non-negative value of this identifier. |
Exceptions
Type |
Condition |
System.ArgumentOutOfRangeException |
The value is negative. |
PrereleaseIdentifier(String, Boolean)
Declaration
public PrereleaseIdentifier(string value, bool allowLeadingZeros = false)
Parameters
Type |
Name |
Description |
System.String |
value |
The string value of this prerelease identifier. |
System.Boolean |
allowLeadingZeros |
Whether to allow leading zeros in the value
parameter. If true, leading zeros will be allowed on numeric identifiers
but will be removed. |
Exceptions
Type |
Condition |
System.ArgumentNullException |
The value is null. |
System.ArgumentException |
The value is empty or contains invalid characters
(i.e. characters that are not ASCII alphanumerics or hyphens) or has leading zeros for
a numeric identifier when allowLeadingZeros is false. |
System.OverflowException |
The numeric identifier value is too large for System.Int32. |
Properties
NumericValue
The numeric value of the prerelease identifier if it is a numeric identifier, otherwise
null.
Declaration
public readonly int? NumericValue { get; }
Property Value
Type |
Description |
System.Nullable<System.Int32> |
The numeric value of the prerelease identifier if it is a numeric identifier,
otherwise null. |
Value
The string value of the prerelease identifier even if it is a numeric identifier.
Declaration
public readonly string Value { get; }
Property Value
Type |
Description |
System.String |
The string value of this prerelease identifier even if it is a numeric identifier
or null if this is a default PrereleaseIdentifier. |
Methods
CompareTo(PrereleaseIdentifier)
Compares two identifiers and indicates whether this instance precedes, follows, or is
equal to the other in precedence order.
Declaration
public readonly int CompareTo(PrereleaseIdentifier value)
Parameters
Returns
Type |
Description |
System.Int32 |
An integer that indicates whether this instance precedes, follows, or is equal to
value in precedence order.
Value | Condition |
---|
-1 | This instance precedes value . | 0 | This instance is equal to value . | 1 | This instance follows value . |
|
CompareTo(Object)
Compares this identifier to an System.Object and indicates whether this instance
precedes, follows, or is equal to the object in precedence order.
Declaration
public readonly int CompareTo(object value)
Parameters
Type |
Name |
Description |
System.Object |
value |
|
Returns
Type |
Description |
System.Int32 |
An integer that indicates whether this instance precedes, follows, or is equal to
value in precedence order.
Value | Condition |
---|
-1 | This instance precedes value . | 0 | This instance is equal to value . | 1 | This instance follows value or value
is null. |
|
Exceptions
Equals(PrereleaseIdentifier)
Determines whether two identifiers are equal.
Declaration
public readonly bool Equals(PrereleaseIdentifier value)
Parameters
Returns
Type |
Description |
System.Boolean |
true if value is equal to the this identifier;
otherwise false. |
Equals(Object)
Determines whether the given object is equal to this identifier.
Declaration
public override readonly bool Equals(object value)
Parameters
Type |
Name |
Description |
System.Object |
value |
|
Returns
Type |
Description |
System.Boolean |
true if value is equal to the this identifier;
otherwise false. |
Overrides
System.ValueType.Equals(System.Object)
GetHashCode()
Gets a hash code for this identifier.
Declaration
public override readonly int GetHashCode()
Returns
Type |
Description |
System.Int32 |
A hash code for this identifier. |
Overrides
System.ValueType.GetHashCode()
ToString()
Converts this identifier into an equivalent string value.
Declaration
public override readonly string ToString()
Returns
Type |
Description |
System.String |
The string value of this identifier or null if this is
a default PrereleaseIdentifier |
Overrides
System.ValueType.ToString()
Operators
Equality(PrereleaseIdentifier, PrereleaseIdentifier)
Determines whether two identifiers are equal.
Declaration
public static bool operator ==(PrereleaseIdentifier left, PrereleaseIdentifier right)
Parameters
Returns
Type |
Description |
System.Boolean |
true if the value of left is the same as
the value of right ; otherwise false. |
Implicit(PrereleaseIdentifier to String)
Converts this identifier into an equivalent string value.
Declaration
public static implicit operator string (PrereleaseIdentifier prereleaseIdentifier)
Parameters
Returns
Type |
Description |
System.String |
The string value of this identifier or null if this is
a default PrereleaseIdentifier |
Inequality(PrereleaseIdentifier, PrereleaseIdentifier)
Determines whether two identifiers are not equal.
Declaration
public static bool operator !=(PrereleaseIdentifier left, PrereleaseIdentifier right)
Parameters
Returns
Type |
Description |
System.Boolean |
true if the value of left is different
from the value of right ; otherwise false. |
Implements
System.IEquatable<T>
System.IComparable<T>
System.IComparable