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
SemVersionThe semantic version.
isPresumed
boolWhether 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
Equals(BrowserVersion)
public override bool Equals(BrowserVersion other)
Parameters
other
BrowserVersion
Returns
GetHashCode()
public override int GetHashCode()
Returns
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
stringThe version string
isPresumed
boolWhether 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
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
stringThe version string
result
SemanticBrowserVersionExposes the result when this method returns true
isPresumed
boolWhether or not this is a presumed version; see IsPresumedVersion