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
object
FileVersion
Implements
IEquatable<>FileVersion
Namespace: StylelabsStylelabs.MStylelabs.M.FrameworkStylelabs.M.Framework.EssentialsVersioning
Assembly: Stylelabs.M.Sdk.WebClient.dll
Syntax
RequestResponse

public class FileVersion : IComparable<FileVersion>, IEquatable<FileVersion>

Constructors

FileVersion()

Initializes a new instance of the FileVersion class.

Declaration
RequestResponse

public FileVersion()

FileVersion(int, int, int, int)

Initializes a new instance of the FileVersion class.

Declaration
RequestResponse

public FileVersion(int major, int minor, int patch, int revision)
Parameters
TypeNameDescription
intmajor

Major version.

intminor

Minor version.

intpatch

Patch version.

intrevision

Revision version.

Properties

Major

Gets or sets the major version.

Declaration
RequestResponse

public int Major { get; set; }
Property Value
TypeDescription
int

Minor

Gets or sets the minor version.

Declaration
RequestResponse

public int Minor { get; set; }
Property Value
TypeDescription
int

Patch

Gets or sets the patch version.

Declaration
RequestResponse

public int Patch { get; set; }
Property Value
TypeDescription
int

Revision

Gets or sets the revision.

Declaration
RequestResponse

public int Revision { get; set; }
Property Value
TypeDescription
int

Methods

CompareTo(FileVersion)

Declaration
RequestResponse

public int CompareTo(FileVersion other)
Parameters
TypeNameDescription
FileVersionother
Returns
TypeDescription
int

Equals(FileVersion)

Declaration
RequestResponse

public bool Equals(FileVersion other)
Parameters
TypeNameDescription
FileVersionother
Returns
TypeDescription
bool

Equals(object)

Declaration
RequestResponse

public override bool Equals(object obj)
Parameters
TypeNameDescription
objectobj
Returns
TypeDescription
bool

GetHashCode()

Declaration
RequestResponse

public override int GetHashCode()
Returns
TypeDescription
int

Parse(string)

Parses the file version string to a FileVersion object.

Declaration
RequestResponse

public static FileVersion Parse(string fileVersion)
Parameters
TypeNameDescription
stringfileVersion

The file version.

Returns
TypeDescription
FileVersion

A FileVersion.

ToString()

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

Declaration
RequestResponse

public override string ToString()
Returns
TypeDescription
string

The version.

TryParse(string, out FileVersion)

Tries to parse the fileVersion.

Declaration
RequestResponse

public static bool TryParse(string fileVersion, out FileVersion result)
Parameters
TypeNameDescription
stringfileVersion

The file version.

FileVersionresult

The result.

Returns
TypeDescription
bool

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

Operators

operator ==(FileVersion, FileVersion)

Equals operator.

Declaration
RequestResponse

public static bool operator ==(FileVersion left, FileVersion right)
Parameters
TypeNameDescription
FileVersionleft

Left operand.

FileVersionright

Right operand.

Returns
TypeDescription
bool

true if operator evaluates to true, false otherwise.

operator >(FileVersion, FileVersion)

Greater than operator.

Declaration
RequestResponse

public static bool operator >(FileVersion left, FileVersion right)
Parameters
TypeNameDescription
FileVersionleft

Left operand.

FileVersionright

Right operand.

Returns
TypeDescription
bool

true if operator evaluates to true, false otherwise.

operator >=(FileVersion, FileVersion)

Greater or equals to operator.

Declaration
RequestResponse

public static bool operator >=(FileVersion left, FileVersion right)
Parameters
TypeNameDescription
FileVersionleft

Left operand.

FileVersionright

Right operand.

Returns
TypeDescription
bool

true if operator evaluates to true, false otherwise.

operator !=(FileVersion, FileVersion)

Not equals operator.

Declaration
RequestResponse

public static bool operator !=(FileVersion left, FileVersion right)
Parameters
TypeNameDescription
FileVersionleft

Left operand.

FileVersionright

Right operand.

Returns
TypeDescription
bool

true if operator evaluates to true, false otherwise.

operator <(FileVersion, FileVersion)

Less than operator.

Declaration
RequestResponse

public static bool operator <(FileVersion left, FileVersion right)
Parameters
TypeNameDescription
FileVersionleft

Left operand.

FileVersionright

Right operand.

Returns
TypeDescription
bool

true if operator evaluates to true, false otherwise.

operator <=(FileVersion, FileVersion)

Less or equals to operator.

Declaration
RequestResponse

public static bool operator <=(FileVersion left, FileVersion right)
Parameters
TypeNameDescription
FileVersionleft

Left operand.

FileVersionright

Right operand.

Returns
TypeDescription
bool

true if operator evaluates to true, false otherwise.

Implements

IEquatable<>

Do you have some feedback for us?

If you have suggestions for improving this article,