Show / Hide Table of Contents

Class ImplementationVersion

Represents a version number consisting of dot-separated decimals and optional modifier strings.

Inheritance
Object
ImplementationVersion
Implements
IComparable<ImplementationVersion>
IEquatable<ImplementationVersion>
Namespace: ZeroInstall.Model
Assembly: ZeroInstall.Model.dll
Syntax
public sealed class ImplementationVersion : Object
Remarks

This class is immutable and thread-safe.

This is the syntax for valid version strings:

Version := DottedList ("-" Modifier? DottedList?)*
DottedList := (Integer ("." Integer)*)
Modifier := "pre" | "rc" | "post"
If the string ContainsTemplateVariables(String) the entire string is stored verbatim and not parsed.

Constructors

ImplementationVersion(String)

Creates a new implementation version from a a string.

Declaration
public ImplementationVersion(string value)
Parameters
Type Name Description
String value

The string containing the version information.

Exceptions
Type Condition
FormatException

value is not a valid version string.

ImplementationVersion(Version)

Creates a new implementation version from a .NET Version.

Declaration
public ImplementationVersion(Version version)
Parameters
Type Name Description
Version version

The .NET Version to convert.

ImplementationVersion(VersionDottedList, VersionPart[])

Creates a new implementation version.

Declaration
public ImplementationVersion(VersionDottedList firstPart, params VersionPart[] additionalParts)
Parameters
Type Name Description
VersionDottedList firstPart

The first part of the version number.

VersionPart[] additionalParts

All additional parts of the version number.

Properties

AdditionalParts

All additional parts of the version number.

Declaration
public IReadOnlyList<VersionPart> AdditionalParts { get; }
Property Value
Type Description
IReadOnlyList<VersionPart>

ContainsTemplateVariables

Indicates whether this version number contains a template variable (a substring enclosed in curly brackets, e.g {var}) .

Declaration
public bool ContainsTemplateVariables { get; }
Property Value
Type Description
Boolean
Remarks

This must be false in regular feeds; true is only valid for templates.

FirstPart

The first part of the version number.

Declaration
public VersionDottedList FirstPart { get; }
Property Value
Type Description
VersionDottedList

Methods

CompareTo(ImplementationVersion)

Declaration
public int CompareTo(ImplementationVersion other)
Parameters
Type Name Description
ImplementationVersion other
Returns
Type Description
Int32

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
Object obj
Returns
Type Description
Boolean

Equals(ImplementationVersion)

Declaration
public bool Equals(ImplementationVersion other)
Parameters
Type Name Description
ImplementationVersion other
Returns
Type Description
Boolean

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

ToString()

Returns a string representation of the version. Safe for parsing!

Declaration
public override string ToString()
Returns
Type Description
String

TryCreate(String, out ImplementationVersion)

Creates a new ImplementationVersion using the specified string representation.

Declaration
public static bool TryCreate(string value, out ImplementationVersion result)
Parameters
Type Name Description
String value

The string to parse.

ImplementationVersion result

Returns the created ImplementationVersion if successfully; null otherwise.

Returns
Type Description
Boolean

true if the ImplementationVersion was successfully created; false otherwise.

Operators

Equality(ImplementationVersion, ImplementationVersion)

Indicates whether the object on the left is equal to the object on the right.

Declaration
public static bool operator ==(ImplementationVersion left, ImplementationVersion right)
Parameters
Type Name Description
ImplementationVersion left

The left object

ImplementationVersion right

The right object

Returns
Type Description
Boolean

true if the objects are equal; otherwise, false.

GreaterThan(ImplementationVersion, ImplementationVersion)

Declaration
public static bool operator>(ImplementationVersion left, ImplementationVersion right)
Parameters
Type Name Description
ImplementationVersion left
ImplementationVersion right
Returns
Type Description
Boolean

GreaterThanOrEqual(ImplementationVersion, ImplementationVersion)

Declaration
public static bool operator >=(ImplementationVersion left, ImplementationVersion right)
Parameters
Type Name Description
ImplementationVersion left
ImplementationVersion right
Returns
Type Description
Boolean

Inequality(ImplementationVersion, ImplementationVersion)

Indicates whether the object on the left is not equal to the object on the right.

Declaration
public static bool operator !=(ImplementationVersion left, ImplementationVersion right)
Parameters
Type Name Description
ImplementationVersion left

The left object

ImplementationVersion right

The right object

Returns
Type Description
Boolean

true if the objects are not equal; otherwise, false.

LessThan(ImplementationVersion, ImplementationVersion)

Declaration
public static bool operator <(ImplementationVersion left, ImplementationVersion right)
Parameters
Type Name Description
ImplementationVersion left
ImplementationVersion right
Returns
Type Description
Boolean

LessThanOrEqual(ImplementationVersion, ImplementationVersion)

Declaration
public static bool operator <=(ImplementationVersion left, ImplementationVersion right)
Parameters
Type Name Description
ImplementationVersion left
ImplementationVersion right
Returns
Type Description
Boolean

Implements

System.IComparable<T>
System.IEquatable<T>
In This Article
Back to top Copyright Bastian Eicher et al