Struct SpecVersion
A three-component S-100 version of the form
<major>.<minor>.<clarification>, with the
compatibility semantics defined by S-100 Edition 5.2.1 Part 2 §6
(Maintenance):
- Major — backward-incompatible change.
- Minor — backward-compatible addition (new feature classes, attributes, code-list entries, etc.).
- Clarification — editorial change with no semantic impact on the data model.
This is not Semantic Versioning despite its similar shape — there are no pre-release tags, no build metadata, and clarification-level differences are interchangeable for compatibility purposes.
public readonly record struct SpecVersion : IComparable<SpecVersion>, IEquatable<SpecVersion>
- Implements
- Inherited Members
Constructors
SpecVersion(int, int, int)
Creates a new SpecVersion. All components must be non-negative.
public SpecVersion(int major, int minor, int clarification)
Parameters
Properties
Clarification
Clarification component (editorial-only changes).
public int Clarification { get; }
Property Value
Major
Major component (backward-incompatible change boundary).
public int Major { get; }
Property Value
Minor
Minor component (backward-compatible additions).
public int Minor { get; }
Property Value
Methods
CompareTo(SpecVersion)
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(SpecVersion other)
Parameters
otherSpecVersionAn 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.
IsBackwardCompatibleWith(SpecVersion)
Returns true when a consumer conforming to this version can read
content produced for older — i.e. the two share the
same major component and this version's minor is at least as high as
the older one's. Clarification-level differences are ignored
per S-100 Part 2 §6.
public bool IsBackwardCompatibleWith(SpecVersion older)
Parameters
olderSpecVersion
Returns
Parse(string)
Parses a version string of the form "M", "M.m", or
"M.m.c". Missing trailing components default to 0.
public static SpecVersion Parse(string s)
Parameters
sstring
Returns
Exceptions
- FormatException
The input is not a valid version string.
ToString()
Returns the canonical "M.m.c" representation.
public override string ToString()
Returns
TryParse(string?, out SpecVersion)
Attempts to parse a version string of the form "M", "M.m",
or "M.m.c". Missing trailing components default to 0.
public static bool TryParse(string? s, out SpecVersion value)
Parameters
sstringvalueSpecVersion
Returns
Operators
operator >(SpecVersion, SpecVersion)
Returns true when left follows right (see CompareTo(SpecVersion)).
public static bool operator >(SpecVersion left, SpecVersion right)
Parameters
leftSpecVersionThe first version.
rightSpecVersionThe second version.
Returns
operator >=(SpecVersion, SpecVersion)
Returns true when left follows or equals right (see CompareTo(SpecVersion)).
public static bool operator >=(SpecVersion left, SpecVersion right)
Parameters
leftSpecVersionThe first version.
rightSpecVersionThe second version.
Returns
operator <(SpecVersion, SpecVersion)
Returns true when left precedes right (see CompareTo(SpecVersion)).
public static bool operator <(SpecVersion left, SpecVersion right)
Parameters
leftSpecVersionThe first version.
rightSpecVersionThe second version.
Returns
operator <=(SpecVersion, SpecVersion)
Returns true when left precedes or equals right (see CompareTo(SpecVersion)).
public static bool operator <=(SpecVersion left, SpecVersion right)
Parameters
leftSpecVersionThe first version.
rightSpecVersionThe second version.