Zero Install .NET API 2.20.0
ZeroInstall.Model.VersionRange Class Reference

Represents a (possibly disjoint) set of ranges of ImplementationVersions. More...

Inheritance diagram for ZeroInstall.Model.VersionRange:

Public Member Functions

 VersionRange ()
 Creates an empty version range (matches everything).
 
 VersionRange (params VersionRangePart[] parts)
 Creates a new version range set. More...
 
 VersionRange (string value)
 Creates a new version range set from a a string. More...
 
VersionRange Intersect (VersionRange? other)
 Intersects another version range set with this one and returns a new set as the result.
 
bool Match (ImplementationVersion version)
 Determines whether a specific version lies within this range set.
 
override string ToString ()
 Returns a string representation of the version range set. Safe for parsing!
 
bool Equals (VersionRange? other)
 
override bool Equals (object? obj)
 
override int GetHashCode ()
 

Static Public Member Functions

static implicit operator VersionRange? (ImplementationVersion? version)
 Convenience cast for ImplementationVersions into VersionRanges that match that exact version.
 
static implicit operator VersionRange? (Constraint? constraint)
 Convenience cast for Constraints into VersionRanges.
 
static bool TryCreate (string value, [NotNullWhen(true)] out VersionRange? result)
 Creates a new VersionRange using the specified string representation. More...
 
static bool operator== (VersionRange? left, VersionRange? right)
 
static bool operator!= (VersionRange? left, VersionRange? right)
 

Static Public Attributes

static readonly VersionRange None = new(new VersionRangePartRange(new("0"), new("0")))
 An "impossible" range matching no versions.
 

Properties

IReadOnlyList< VersionRangePartParts [get]
 The individual ranges.
 

Detailed Description

Represents a (possibly disjoint) set of ranges of ImplementationVersions.

This class is immutable.

Ranges are separated by pipes (|). Each range is in the form "START..!END". The range matches versions where START <= VERSION < END. The start or end may be omitted. A single version number may be used instead of a range to match only that version, or !VERSION to match everything except that version.

Constructor & Destructor Documentation

◆ VersionRange() [1/2]

ZeroInstall.Model.VersionRange.VersionRange ( params VersionRangePart[]  parts)
inline

Creates a new version range set.

Parameters
partsThe individual ranges.

◆ VersionRange() [2/2]

ZeroInstall.Model.VersionRange.VersionRange ( string  value)
inline

Creates a new version range set from a a string.

Parameters
valueThe string containing the version ranges.
Exceptions
FormatExceptionvalue is not a valid version range string.

Member Function Documentation

◆ TryCreate()

static bool ZeroInstall.Model.VersionRange.TryCreate ( string  value,
[NotNullWhen(true)] out VersionRange result 
)
inlinestatic

Creates a new VersionRange using the specified string representation.

Parameters
valueThe string to parse.
resultReturns the created VersionRange if successfully; null otherwise.
Returns
true if the VersionRange was successfully created; false otherwise.

The documentation for this class was generated from the following file: