Class PlatformVersion
A version of the RDCore platform, or of the RDCore.SDK package that a part of it was built with, as Semantic Versioning 2.0 writes one:
0.1.0, 0.2.0-alpha.3.
public sealed record PlatformVersion : IComparable<PlatformVersion>, IEquatable<PlatformVersion>
- Inheritance
-
PlatformVersion
- Implements
- Inherited Members
Remarks
It is the version that rdcore.json's platformVersion, a release tag without its leading v, and
release.json's sdk name. Versions are ordered as Semantic Versioning 2.0 orders them: a prerelease comes before its release, and build
metadata is ignored. Every program that deploys a platform reads, orders and names a version this way, so that a version deployed by one
is found by the others, in the same folder.
Properties
CompatibleRange
The range of versions this one is compatible with, as a person reads it: 0.1.x before 1.0, and 1.x from 1.0.
public string CompatibleRange { get; }
Property Value
Core
The major, minor and patch numbers.
public Version Core { get; }
Property Value
IsPrerelease
Whether this is a prerelease.
public bool IsPrerelease { get; }
Property Value
Prerelease
The prerelease identifiers, such as alpha and 3; empty for a release.
public IReadOnlyList<string> Prerelease { get; }
Property Value
Text
The version in lowercase, without a leading v or build metadata: V0.1.0-RC.1+build.5 is 0.1.0-rc.1.
public string Text { get; }
Property Value
Remarks
A deployed platform's folder is named by it.
Methods
CompareTo(PlatformVersion?)
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(PlatformVersion? other)
Parameters
otherPlatformVersionAn 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.
Equals(PlatformVersion?)
Whether both are the same version, by CompareTo(PlatformVersion?).
public bool Equals(PlatformVersion? other)
Parameters
otherPlatformVersionThe other version.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
IsCompatibleWith(PlatformVersion)
Whether a part built with this RDCore.SDK version and a part built with other work together: the same major and
minor versions before 1.0, and the same major version from 1.0.
public bool IsCompatibleWith(PlatformVersion other)
Parameters
otherPlatformVersionThe other part's RDCore.SDK version.
Returns
Remarks
The rule is symmetric, and ignores the patch number and the prerelease identifiers: 0.1.1-alpha works with 0.1.0, and
not with 0.2.0; 1.2.0 works with 1.0.0, and not with 2.0.0.
Parse(string)
Reads a version, with or without a leading v.
public static PlatformVersion Parse(string text)
Parameters
textstringThe version's text, such as
0.2.0-alpha.3.
Returns
Exceptions
- FormatException
textis not a version.
ToString()
The version's Text.
public override string ToString()
Returns
TryParse(string?, out PlatformVersion?)
Reads a version, with or without a leading v; false when it is not one.
public static bool TryParse(string? text, out PlatformVersion? version)
Parameters
textstringThe version's text, such as
0.2.0-alpha.3,v0.2.0or0.1.1-alpha+2062f98.versionPlatformVersionThe version read; null when it is not one.
Returns
Operators
operator >(PlatformVersion, PlatformVersion)
Whether left comes after right.
public static bool operator >(PlatformVersion left, PlatformVersion right)
Parameters
leftPlatformVersionThe first version.
rightPlatformVersionThe second version.
Returns
operator >=(PlatformVersion, PlatformVersion)
Whether left comes after right, or is the same version.
public static bool operator >=(PlatformVersion left, PlatformVersion right)
Parameters
leftPlatformVersionThe first version.
rightPlatformVersionThe second version.
Returns
operator <(PlatformVersion, PlatformVersion)
Whether left comes before right.
public static bool operator <(PlatformVersion left, PlatformVersion right)
Parameters
leftPlatformVersionThe first version.
rightPlatformVersionThe second version.
Returns
operator <=(PlatformVersion, PlatformVersion)
Whether left comes before right, or is the same version.
public static bool operator <=(PlatformVersion left, PlatformVersion right)
Parameters
leftPlatformVersionThe first version.
rightPlatformVersionThe second version.