Class VersionExtensions
Provides extension methods for System.Version and SemVersion.
Inheritance
object
Namespace: Umbraco.Extensions
Assembly: Umbraco.Core.dll
Syntax
public static class VersionExtensions
Methods
View SourceGetVersion(SemVersion, int)
Converts a SemVersion to a System.Version.
Declaration
public static Version GetVersion(this SemVersion semVersion, int maxParts = 4)
Parameters
| Type | Name | Description |
|---|---|---|
| SemVersion | semVersion | The semantic version to convert. |
| int | maxParts | The maximum number of version parts to include (2, 3, or 4). Defaults to 4. |
Returns
| Type | Description |
|---|---|
| Version | A System.Version instance representing the semantic version. |
SubtractRevision(Version)
Subtracts one from the revision number of a version.
Declaration
public static Version SubtractRevision(this Version version)
Parameters
| Type | Name | Description |
|---|---|---|
| Version | version | The version to modify. |
Returns
| Type | Description |
|---|---|
| Version | A new version with the revision decremented by one. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown when attempting to subtract from a zero version. |