Table of Contents

Class SemanticBrowserVersion

Namespace
CSF.Extensions.WebDriver.Identification
Assembly
CSF.Extensions.WebDriver.dll

Implementation of BrowserVersion which represents a semantic version.

public sealed class SemanticBrowserVersion : BrowserVersion, IEquatable<BrowserVersion>, IComparable<BrowserVersion>
Inheritance
SemanticBrowserVersion
Implements
Inherited Members

Remarks

This is a version which complies with the specification at https://semver.org

Actually, this class permits version strings which are somewhat less strict than the standards set-out at the semantic versioning website. The TryParse(string, out SemanticBrowserVersion, bool) method makes use of the parsing functionality within TryParse(string, SemVersionStyles, out SemVersion, int) to permit some common improper representations of a semantic version. The TryParse function in this class uses Semver.SemVersionStyles.Any to enable very generous parsing.

Constructors

SemanticBrowserVersion(SemVersion, bool)

Initialises a new instance of SemanticBrowserVersion

public SemanticBrowserVersion(SemVersion version, bool isPresumed = false)

Parameters

version SemVersion

The semantic version.

isPresumed bool

Whether or not this is a presumed version; see IsPresumedVersion.

Exceptions

ArgumentNullException

If version is null.

Properties

Version

Gets the semantic version represented by the current instance.

public SemVersion Version { get; }

Property Value

SemVersion

Methods

CompareTo(BrowserVersion)

public override int CompareTo(BrowserVersion other)

Parameters

other BrowserVersion

Returns

int

Equals(BrowserVersion)

public override bool Equals(BrowserVersion other)

Parameters

other BrowserVersion

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Parse(string, bool)

Creates a SemanticBrowserVersion from a string, raising an exception if the string is not a valid version.

public static SemanticBrowserVersion Parse(string version, bool isPresumed = false)

Parameters

version string

The version string

isPresumed bool

Whether or not this is a presumed version; see IsPresumedVersion

Returns

SemanticBrowserVersion

A semantic browser version.

Remarks

Consider using TryParse(string, out SemanticBrowserVersion, bool) if you are not certain that the version string is valid.

Exceptions

FormatException

If the version is not a valid semantic version.

ToString()

public override string ToString()

Returns

string

TryParse(string, out SemanticBrowserVersion, bool)

Attempts to parse the specified version string as a SemanticBrowserVersion.

public static bool TryParse(string version, out SemanticBrowserVersion result, bool isPresumed = false)

Parameters

version string

The version string

result SemanticBrowserVersion

Exposes the result when this method returns true

isPresumed bool

Whether or not this is a presumed version; see IsPresumedVersion

Returns

bool

true if the parsing succeeded; false if not.