logo
logo

Class FileVersion

Represents the file version of an m assembly. It consists of exactly 4 numbers separated by dots.

Represented as: "Major.Minor.Patch.Revision" For example: "3.0.0.599".

It supports all kinds of equality and comparisons.

Inheritance
System.Object
FileVersion
Implements
IEquatable<FileVersion>
Namespace: Stylelabs.M.Framework.Essentials.Versioning
Assembly: Stylelabs.M.Sdk.WebClient.dll
Syntax
public class FileVersion : IComparable<FileVersion>

Constructors

FileVersion()

Initializes a new instance of the FileVersion class.

Declaration
public FileVersion()

FileVersion(Int32, Int32, Int32, Int32)

Initializes a new instance of the FileVersion class.

Declaration
public FileVersion(int major, int minor, int patch, int revision)
Parameters
Type Name Description
System.Int32 major

Major version.

System.Int32 minor

Minor version.

System.Int32 patch

Patch version.

System.Int32 revision

Revision version.

Properties

Major

Gets or sets the major version.

Declaration
public int Major { get; set; }
Property Value
Type Description
System.Int32

Minor

Gets or sets the minor version.

Declaration
public int Minor { get; set; }
Property Value
Type Description
System.Int32

Patch

Gets or sets the patch version.

Declaration
public int Patch { get; set; }
Property Value
Type Description
System.Int32

Revision

Gets or sets the revision.

Declaration
public int Revision { get; set; }
Property Value
Type Description
System.Int32

Methods

CompareTo(FileVersion)

Declaration
public int CompareTo(FileVersion other)
Parameters
Type Name Description
FileVersion other
Returns
Type Description
System.Int32

Equals(FileVersion)

Declaration
public bool Equals(FileVersion other)
Parameters
Type Name Description
FileVersion other
Returns
Type Description
System.Boolean

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

Parse(String)

Parses the file version string to a FileVersion object.

Declaration
public static FileVersion Parse(string fileVersion)
Parameters
Type Name Description
System.String fileVersion

The file version.

Returns
Type Description
FileVersion

A FileVersion.

ToString()

Creates a string representation, e.g. "3.0.0.599". Represented as: "Major.Minor.Patch.Revision".

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

The version.

TryParse(String, out FileVersion)

Tries to parse the fileVersion.

Declaration
public static bool TryParse(string fileVersion, out FileVersion result)
Parameters
Type Name Description
System.String fileVersion

The file version.

FileVersion result

The result.

Returns
Type Description
System.Boolean

true if result was successfully set. false if fileVersion could not be parsed.

Operators

Equality(FileVersion, FileVersion)

Equals operator.

Declaration
public static bool operator ==(FileVersion left, FileVersion right)
Parameters
Type Name Description
FileVersion left

Left operand.

FileVersion right

Right operand.

Returns
Type Description
System.Boolean

true if operator evaluates to true, false otherwise.

GreaterThan(FileVersion, FileVersion)

Greater than operator.

Declaration
public static bool operator>(FileVersion left, FileVersion right)
Parameters
Type Name Description
FileVersion left

Left operand.

FileVersion right

Right operand.

Returns
Type Description
System.Boolean

true if operator evaluates to true, false otherwise.

GreaterThanOrEqual(FileVersion, FileVersion)

Greater or equals to operator.

Declaration
public static bool operator >=(FileVersion left, FileVersion right)
Parameters
Type Name Description
FileVersion left

Left operand.

FileVersion right

Right operand.

Returns
Type Description
System.Boolean

true if operator evaluates to true, false otherwise.

Inequality(FileVersion, FileVersion)

Not equals operator.

Declaration
public static bool operator !=(FileVersion left, FileVersion right)
Parameters
Type Name Description
FileVersion left

Left operand.

FileVersion right

Right operand.

Returns
Type Description
System.Boolean

true if operator evaluates to true, false otherwise.

LessThan(FileVersion, FileVersion)

Less than operator.

Declaration
public static bool operator <(FileVersion left, FileVersion right)
Parameters
Type Name Description
FileVersion left

Left operand.

FileVersion right

Right operand.

Returns
Type Description
System.Boolean

true if operator evaluates to true, false otherwise.

LessThanOrEqual(FileVersion, FileVersion)

Less or equals to operator.

Declaration
public static bool operator <=(FileVersion left, FileVersion right)
Parameters
Type Name Description
FileVersion left

Left operand.

FileVersion right

Right operand.

Returns
Type Description
System.Boolean

true if operator evaluates to true, false otherwise.

Implements

IEquatable<>

Can we improve this article ? Provide feedback