Show / Hide Table of Contents

Struct Version

Struct holding project version information.

Implements
System.IComparable
System.IComparable<Version>
System.IEquatable<Version>
Namespace: sttz.Trimmer
Assembly: Trimmer.dll
Syntax
[Serializable]
public struct Version : IComparable, IComparable<Version>, IEquatable<Version>
Remarks

This class is following basic semantic versioning principles.

Constructors

| Improve this Doc View Source

Version(Int32, Int32, Int32, Int32, String, String)

Create a new version instance.

Declaration
public Version(int major, int minor, int patch, int build = 0, string commit = null, string branch = null)
Parameters
Type Name Description
System.Int32 major
System.Int32 minor
System.Int32 patch
System.Int32 build
System.String commit
System.String branch

Fields

| Improve this Doc View Source

branch

An identifier for the versioned branch from which this version was created.

Declaration
public string branch
Field Value
Type Description
System.String
| Improve this Doc View Source

build

The build number.

Declaration
public int build
Field Value
Type Description
System.Int32
| Improve this Doc View Source

commit

An identifier for the versioned commit from which this version was created.

Declaration
public string commit
Field Value
Type Description
System.String
| Improve this Doc View Source

major

The major version of the project.

Declaration
public int major
Field Value
Type Description
System.Int32
| Improve this Doc View Source

minor

The minor version of the project.

Declaration
public int minor
Field Value
Type Description
System.Int32
| Improve this Doc View Source

patch

The patch version of the project.

Declaration
public int patch
Field Value
Type Description
System.Int32

Properties

| Improve this Doc View Source

IsDefined

Check if this struct represents a valid version.

Declaration
public bool IsDefined { get; }
Property Value
Type Description
System.Boolean
Remarks

i.e. major, minor and patch must not be negative and one of them must be greater than 0.

| Improve this Doc View Source

MajorMinor

Return the version as major.minor string (e.g. 1.2)

Declaration
public string MajorMinor { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

MajorMinorPatch

Return the version as major.minor.patch string (e.g. 1.2.3)

Declaration
public string MajorMinorPatch { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

MajorMinorPatchBuild

Return the version as major.minor.patch.build string (e.g. 1.2.3+4)

Declaration
public string MajorMinorPatchBuild { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

ProjectVersion

The main project version.

Declaration
public static Version ProjectVersion { get; set; }
Property Value
Type Description
Version
Remarks

This property will be populated from the VersionContainer. The OptionVersion injects the container into the build, so the version is always without additional setup.

Methods

| Improve this Doc View Source

CompareTo(Version)

Declaration
public int CompareTo(Version other)
Parameters
Type Name Description
Version other
Returns
Type Description
System.Int32
| Improve this Doc View Source

CompareTo(Object)

Declaration
public int CompareTo(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Int32
| Improve this Doc View Source

Equals(Version)

Declaration
public bool Equals(Version other)
Parameters
Type Name Description
Version other
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.ValueType.Equals(System.Object)
| Improve this Doc View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.ValueType.GetHashCode()
| Improve this Doc View Source

Parse(String)

Parse a version string in the format "x.x.x".

Declaration
public static Version Parse(string input)
Parameters
Type Name Description
System.String input
Returns
Type Description
Version
| Improve this Doc View Source

Parse(String, out String)

Parse a version string in the format "x.x.x".

Declaration
public static Version Parse(string input, out string error)
Parameters
Type Name Description
System.String input
System.String error
Returns
Type Description
Version
| Improve this Doc View Source

ToString()

Returns the version as a string in the form "major.minor.patch (build)" (e.g. "1.2.3 (4)")

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.ValueType.ToString()

Operators

| Improve this Doc View Source

Equality(Version, Version)

Declaration
public static bool operator ==(Version lhs, Version rhs)
Parameters
Type Name Description
Version lhs
Version rhs
Returns
Type Description
System.Boolean
| Improve this Doc View Source

GreaterThan(Version, Version)

Declaration
public static bool operator>(Version lhs, Version rhs)
Parameters
Type Name Description
Version lhs
Version rhs
Returns
Type Description
System.Boolean
| Improve this Doc View Source

GreaterThanOrEqual(Version, Version)

Declaration
public static bool operator >=(Version lhs, Version rhs)
Parameters
Type Name Description
Version lhs
Version rhs
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Inequality(Version, Version)

Declaration
public static bool operator !=(Version lhs, Version rhs)
Parameters
Type Name Description
Version lhs
Version rhs
Returns
Type Description
System.Boolean
| Improve this Doc View Source

LessThan(Version, Version)

Declaration
public static bool operator <(Version lhs, Version rhs)
Parameters
Type Name Description
Version lhs
Version rhs
Returns
Type Description
System.Boolean
| Improve this Doc View Source

LessThanOrEqual(Version, Version)

Declaration
public static bool operator <=(Version lhs, Version rhs)
Parameters
Type Name Description
Version lhs
Version rhs
Returns
Type Description
System.Boolean

Implements

System.IComparable
System.IComparable<T>
System.IEquatable<T>
  • Improve this Doc
  • View Source
Back to top © 2017 Adrian Stutz