Class SemanticVersion
Representation of the Dependency semantic version.
Inheritance
Inherited Members
Namespace: StansAssets.Foundation.Editor
Assembly: cs.temp.dll.dll
Syntax
public class SemanticVersion
Constructors
SemanticVersion(Int32, Int32, Int32, String, String)
Initializes a new instance of the SemanticVersion class with provided properties.
Declaration
public SemanticVersion(int major, int minor, int patch, string preRelease, string buildMetadata)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | major | The major version number. |
System.Int32 | minor | The minor version number. |
System.Int32 | patch | The patch version number. |
System.String | preRelease | The pre-release data string. |
System.String | buildMetadata | The build metadata string. |
SemanticVersion(String)
Initializes a new instance of the SemanticVersion class with provided data.
Declaration
public SemanticVersion(string versionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | versionString | String which contains SemanticVersion data. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when versionString has incorrect format |
Properties
BuildMetadata
The build metadata string.
Declaration
public string BuildMetadata { get; }
Property Value
Type | Description |
---|---|
System.String |
HasBuildMetadata
True if the SemanticVersion has build metadata string set; otherwise, false.
Declaration
public bool HasBuildMetadata { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
HasPreRelease
True if the SemanticVersion has pre-release data string set; otherwise, false.
Declaration
public bool HasPreRelease { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Major
The major version number.
Declaration
public int Major { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Minor
The minor version number.
Declaration
public int Minor { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Patch
The patch version number.
Declaration
public int Patch { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
PreRelease
The pre-release data string.
Declaration
public string PreRelease { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Equals(Object)
Determines whether two SemanticVersion instances are equal.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object to compare with the current SemanticVersion. |
Returns
Type | Description |
---|---|
System.Boolean | 'true' if the specified object is equal to the current SemanticVersion; otherwise, 'false'. |
Overrides
GetHashCode()
Generates a hash of this object data.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | Hash of this object. |
Overrides
ToString()
Returns a string that represents the current SemanticVersion.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string that represents the current SemanticVersion. |
Overrides
TryCreateSemanticVersion(String, out SemanticVersion)
Tries to create a new instance of the SemanticVersion class with provided data.
Declaration
public static bool TryCreateSemanticVersion(string versionString, out SemanticVersion semanticVersion)
Parameters
Type | Name | Description |
---|---|---|
System.String | versionString | String which contains SemanticVersion data. |
SemanticVersion | semanticVersion | When this method returns, contains the SemanticVersion object with provided data, if versionString has correct format; otherwise, null. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
System.Boolean | 'true' if the SemanticVersion has been successfully created; otherwise, 'false'. |
Operators
GreaterThan(SemanticVersion, SemanticVersion)
Compares two SemanticVersion objects. Major, Minor and Patch version numbers will be compared one by one respectively.
Declaration
public static bool operator>(SemanticVersion semanticVersion, SemanticVersion other)
Parameters
Type | Name | Description |
---|---|---|
SemanticVersion | semanticVersion | SemanticVersion object which you want to compare. |
SemanticVersion | other | SemanticVersion object which you want to compare to. |
Returns
Type | Description |
---|---|
System.Boolean |
LessThan(SemanticVersion, SemanticVersion)
Compares two SemanticVersion objects. Major, Minor and Patch version numbers will be compared one by one respectively.
Declaration
public static bool operator <(SemanticVersion semanticVersion, SemanticVersion other)
Parameters
Type | Name | Description |
---|---|---|
SemanticVersion | semanticVersion | SemanticVersion object which you want to compare. |
SemanticVersion | other | SemanticVersion object which you want to compare to. |
Returns
Type | Description |
---|---|
System.Boolean |