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
versionSemVersionThe semantic version.
isPresumedboolWhether or not this is a presumed version; see IsPresumedVersion.
Exceptions
- ArgumentNullException
If
versionis 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
otherBrowserVersion
Returns
Equals(BrowserVersion)
public override bool Equals(BrowserVersion other)
Parameters
otherBrowserVersion
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
versionstringThe version string
isPresumedboolWhether 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
versionis 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
versionstringThe version string
resultSemanticBrowserVersionExposes the result when this method returns true
isPresumedboolWhether or not this is a presumed version; see IsPresumedVersion