Table of Contents

Struct Version

Namespace
Sdl3Sharp
Assembly
Sdl3Sharp.dll

Represents a version consisting of a major-, minor-, and a micro-component

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)

Represents a version consisting of a major-, minor-, and a micro-component

public Version(int major, int minor, int micro)

Parameters

major int

The major version component of the version

minor int

The minor version component of the version

micro int

The micro version component of the version

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

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

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

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

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

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

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

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

other Version

An 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 other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

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

obj object

An 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 obj in the sort order.
Zero This instance occurs in the same position in the sort order as obj.
Greater than zero This instance follows obj in the sort order.

Exceptions

ArgumentException

obj is 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

major int

The major version component of the version

minor int

The minor version component of the version

micro int

The micro version component of the version

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

Equals(Version)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Version other)

Parameters

other Version

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

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

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

ToString(IFormatProvider?)

Formats the value of the current instance using the specified format.

public string ToString(IFormatProvider? formatProvider)

Parameters

formatProvider IFormatProvider

The provider to use to format the value.

-or-

A null reference (Nothing in 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

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

ToString(string?)

Formats the value of the current instance using the specified format.

public string ToString(string? format)

Parameters

format string

The format to use.

-or-

A null reference (Nothing in 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

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

ToString(string?, IFormatProvider?)

Formats the value of the current instance using the specified format.

public string ToString(string? format, IFormatProvider? formatProvider)

Parameters

format string

The format to use.

-or-

A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

formatProvider IFormatProvider

The provider to use to format the value.

-or-

A null reference (Nothing in 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

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

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

destination Span<char>

The span in which to write this instance's value formatted as a span of characters.

charsWritten int

When this method returns, contains the number of characters that were written in destination.

format ReadOnlySpan<char>

A span containing the characters that represent a standard or custom format string that defines the acceptable format for destination.

provider IFormatProvider

An optional object that supplies culture-specific formatting information for destination.

Returns

bool

true if the formatting was successful; otherwise, false.

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

Operators

operator ==(Version, Version)

Compares two values to determine equality.

public static bool operator ==(Version left, Version right)

Parameters

left Version

The value to compare with right.

right Version

The value to compare with left.

Returns

bool

true if left is equal to right; otherwise, false.

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

explicit operator Version(Version)

Converts a Version into a Version

public static explicit operator Version(Version value)

Parameters

value Version

The Version to convert

Returns

Version

The converted Version

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

explicit operator Version(Version)

Converts a Version into a Version

public static explicit operator Version(Version value)

Parameters

value Version

The Version to convert

Returns

Version

The converted Version

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

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

operator >(Version, Version)

Compares two values to determine which is greater.

public static bool operator >(Version left, Version right)

Parameters

left Version

The value to compare with right.

right Version

The value to compare with left.

Returns

bool

true if left is greater than right; otherwise, false.

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

operator >=(Version, Version)

Compares two values to determine which is greater or equal.

public static bool operator >=(Version left, Version right)

Parameters

left Version

The value to compare with right.

right Version

The value to compare with left.

Returns

bool

true if left is greater than or equal to right; otherwise, false.

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

operator !=(Version, Version)

Compares two values to determine inequality.

public static bool operator !=(Version left, Version right)

Parameters

left Version

The value to compare with right.

right Version

The value to compare with left.

Returns

bool

true if left is not equal to right; otherwise, false.

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

operator <(Version, Version)

Compares two values to determine which is less.

public static bool operator <(Version left, Version right)

Parameters

left Version

The value to compare with right.

right Version

The value to compare with left.

Returns

bool

true if left is less than right; otherwise, false.

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000

operator <=(Version, Version)

Compares two values to determine which is less or equal.

public static bool operator <=(Version left, Version right)

Parameters

left Version

The value to compare with right.

right Version

The value to compare with left.

Returns

bool

true if left is less than or equal to right; otherwise, false.

Exceptions

ArgumentOutOfRangeException

major is less than 0 or not less than 1000

  • or - minor is less than 0 or not less than 1000
  • or - micro is less than 0 or not less than 1000