---
title: Version
summary: API reference for Version.
status: draft
owner: <owner>
last_reviewed: 2026-07-23
library: SAIF.Framework.Version
reference_type: package
---

# Version

`Version` is a public class implementing `IComparable` that represents a four-part (`Major.Minor.Build.Revision`) version number as a value object, parallel to but independent of `System.Version`. It supports construction from a string or from parts, numeric comparison via operator overloads, canonical string formatting, and template-based incrementing.

## Purpose
- Represent, parse, format, compare, and increment a four-segment version number as a reusable value object.

## Context
- Namespace: `SAIF.Framework.Version`
- Assembly/package: `SAIF.Framework.Version`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| Major | `Public Major As String` | The version's major segment. |
| Minor | `Public Minor As String` | The version's minor segment. |
| Build | `Public Build As String` | The version's build segment. |
| Revision | `Public Revision As String` | The version's revision segment. |
| New | `New(major As String, minor As String, build As String, revision As String)` | Constructs a `Version` from four explicit segment values. |
| New | `New(version As Version)` | Constructs a `Version` by copying another `Version` instance. |
| New | `New(input As String)` | Constructs a `Version` by parsing a dot-delimited version string via `Parse`. |
| CompareTo | `Public Function CompareTo(obj As Object) As Integer` | Implements `IComparable`; compares this instance to another `Version` using `ToInt`-normalized segment values in Major → Minor → Build → Revision precedence. |
| Parse | `Public Shared Function Parse(input As String) As Version` | Splits `input` on `.` and constructs a `Version`, defaulting missing trailing segments to `"0"`. See [BR-002](../../business-rules.md#br-002-missing-trailing-version-segments-default-to-0-when-parsing). |
| ToString | `Public Overrides Function ToString() As String` | Produces the canonical `"{Major}.{Minor}.{Build}.{Revision}"` string form. |
| Increment | `Public Function Increment(format As String) As Version` | Resolves each segment's format token (`*` auto-increment, empty retain, literal, or `{year}`/`{month}`/`{day}` date tokens), mutates the instance in place via an internal `Update`, and returns `Me`. See [BR-003](../../business-rules.md#br-003-a-wildcard-token-in-an-increment-format-means-auto-increment-this-segment), [BR-004](../../business-rules.md#br-004-an-empty-increment-format-token-means-retain-the-current-segment-value-unchanged), and [BR-005](../../business-rules.md#br-005-increment-format-supports-date-template-tokens-year-month-day). |
| `=` (operator) | `Public Shared Operator =(v1 As Version, v2 As Version) As Boolean` | Compares two `Version` instances for numeric equality across all four segments. See [BR-006](../../business-rules.md#br-006-equality-and-ordering-are-defined-purely-by-the-four-numeric-components-not-by-string-equality). |
| `<>` (operator) | `Public Shared Operator <>(v1 As Version, v2 As Version) As Boolean` | Compares two `Version` instances for numeric inequality. |
| `<` (operator) | `Public Shared Operator <(v1 As Version, v2 As Version) As Boolean` | Compares whether `v1` is numerically less than `v2`, segment by segment. Contains a likely copy-paste defect in its "majors equal" branch; see [BR-007](../../business-rules.md#br-007-tautological-major-equality-check-in-the--and--operators).* |
| `>` (operator) | `Public Shared Operator >(v1 As Version, v2 As Version) As Boolean` | Compares whether `v1` is numerically greater than `v2`, segment by segment. Contains the same likely copy-paste defect in its "majors equal" branch as the `<` operator; see [BR-007](../../business-rules.md#br-007-tautological-major-equality-check-in-the--and--operators).* |

## Behavioral notes
- `Parse` always takes `Major` from the first dot-delimited segment with no default applied to it; only `Minor`, `Build`, and `Revision` are defaulted to `"0"` when absent. See [BR-002](../../business-rules.md#br-002-missing-trailing-version-segments-default-to-0-when-parsing).
- All comparison and ordering members normalize segments via the `Extensions.ToInt` extension method before comparing, so string representations like `"1.02.0.0"` and `"1.2.0.0"` compare as equal. See [BR-006](../../business-rules.md#br-006-equality-and-ordering-are-defined-purely-by-the-four-numeric-components-not-by-string-equality).
- In the `<` and `>` operator overloads, the "majors are equal, now compare minors" `ElseIf` branch compares `v2.Major.ToInt = v2.Major.ToInt` (both operands reference `v2`) instead of the presumably intended `v1.Major.ToInt = v2.Major.ToInt`.* This tautological condition does not currently produce incorrect comparison results, because `Major` is evaluated first and correctly gates entry into the branch, but it is a likely copy-paste defect that should be corrected for clarity and correctness. See [BR-007](../../business-rules.md#br-007-tautological-major-equality-check-in-the--and--operators).*
- `Increment` mutates the calling instance in place and returns `Me`, rather than returning a new `Version` instance — callers relying on immutable value-object semantics should be aware of this.*

## Constraints and usage notes
- `Version` implements `IComparable` (non-generic); casting/boxing considerations of `Object`-typed `CompareTo` apply to consumers.
- `Version` is not related to, and does not derive from or convert to/from, the BCL `System.Version` type, despite the naming and structural similarity.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- `SAIF.Framework.Version\Version.vb`
