Struct Version
- Namespace
- Sdl3Sharp
- Assembly
- Sdl3Sharp.dll
public readonly struct Version : IComparable, IComparable<Version>, IEquatable<Version>, ISpanFormattable, IFormattable, IComparisonOperators<Version, Version, bool>, IEqualityOperators<Version, Version, bool>
- Implements
- Inherited Members
Constructors
Version(int, int, int)
public Version(int major, int minor, int micro)
Parameters
majorintThe major version component of the version
minorintThe minor version component of the version
microintThe micro version component of the version
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
Properties
Major
Gets the major version component of the version
public int Major { get; }
Property Value
- int
The major version component of the version
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
Micro
Gets the micro version component of the version
public int Micro { get; }
Property Value
- int
The micro version component of the version
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
Minor
Gets the minor version component of the version
public int Minor { get; }
Property Value
- int
The minor version component of the version
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
Methods
CompareTo(Version)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(Version other)
Parameters
otherVersionAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
CompareTo(object?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object? obj)
Parameters
objobjectAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes objin the sort order.Zero This instance occurs in the same position in the sort order as obj.Greater than zero This instance follows objin the sort order.
Exceptions
- ArgumentException
objis not the same type as this instance.
Deconstruct(out int, out int, out int)
Deconstructs the version into its components
public void Deconstruct(out int major, out int minor, out int micro)
Parameters
majorintThe major version component of the version
minorintThe minor version component of the version
microintThe micro version component of the version
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
Equals(Version)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Version other)
Parameters
otherVersionAn object to compare with this object.
Returns
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
ToString(IFormatProvider?)
Formats the value of the current instance using the specified format.
public string ToString(IFormatProvider? formatProvider)
Parameters
formatProviderIFormatProviderThe provider to use to format the value.
-or-
A null reference (
Nothingin Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
Returns
- string
The value of the current instance in the specified format.
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
ToString(string?)
Formats the value of the current instance using the specified format.
public string ToString(string? format)
Parameters
formatstringThe format to use.
-or-
A null reference (
Nothingin Visual Basic) to use the default format defined for the type of the IFormattable implementation.
Returns
- string
The value of the current instance in the specified format.
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
ToString(string?, IFormatProvider?)
Formats the value of the current instance using the specified format.
public string ToString(string? format, IFormatProvider? formatProvider)
Parameters
formatstringThe format to use.
-or-
A null reference (
Nothingin Visual Basic) to use the default format defined for the type of the IFormattable implementation.formatProviderIFormatProviderThe provider to use to format the value.
-or-
A null reference (
Nothingin Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
Returns
- string
The value of the current instance in the specified format.
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)
Tries to format the value of the current instance into the provided span of characters.
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
Parameters
destinationSpan<char>The span in which to write this instance's value formatted as a span of characters.
charsWrittenintWhen this method returns, contains the number of characters that were written in
destination.formatReadOnlySpan<char>A span containing the characters that represent a standard or custom format string that defines the acceptable format for
destination.providerIFormatProviderAn optional object that supplies culture-specific formatting information for
destination.
Returns
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
Operators
operator ==(Version, Version)
Compares two values to determine equality.
public static bool operator ==(Version left, Version right)
Parameters
Returns
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
explicit operator Version(Version)
public static explicit operator Version(Version value)
Parameters
Returns
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
explicit operator Version(Version)
public static explicit operator Version(Version value)
Parameters
Returns
Remarks
If the Build component of the given value is undefined (-1), the resulting Version will have its Micro component set to 0
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
operator >(Version, Version)
Compares two values to determine which is greater.
public static bool operator >(Version left, Version right)
Parameters
Returns
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
operator >=(Version, Version)
Compares two values to determine which is greater or equal.
public static bool operator >=(Version left, Version right)
Parameters
Returns
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
operator !=(Version, Version)
Compares two values to determine inequality.
public static bool operator !=(Version left, Version right)
Parameters
Returns
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
operator <(Version, Version)
Compares two values to determine which is less.
public static bool operator <(Version left, Version right)
Parameters
Returns
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -
operator <=(Version, Version)
Compares two values to determine which is less or equal.
public static bool operator <=(Version left, Version right)
Parameters
Returns
Exceptions
- ArgumentOutOfRangeException
is less thanmajor0or not less than1000- or -
is less thanminor0or not less than1000 - or -
is less thanmicro0or not less than1000
- or -