---
title: "Class FileVersion"
slug: "web-sdk--stylelabs.m.framework.essentials.versioning.fileversion"
abstract: ""
---
# 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](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html)

## Namespace: StylelabsStylelabs.MStylelabs.M.FrameworkStylelabs.M.Framework.EssentialsVersioning

## Assembly: Stylelabs.M.Sdk.WebClient.dll

## Syntax

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

## Constructors

### FileVersion()

Initializes a new instance of the [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) class.

#### Declaration

```csharp
public FileVersion()
```

### FileVersion(int, int, int, int)

Initializes a new instance of the [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) class.

#### Declaration

```csharp
public FileVersion(int major, int minor, int patch, int revision)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| int | major | Major version. |
| int | minor | Minor version. |
| int | patch | Patch version. |
| int | revision | Revision version. |

## Properties

### Major

Gets or sets the major version.

#### Declaration

```csharp
public int Major { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| int |  |

### Minor

Gets or sets the minor version.

#### Declaration

```csharp
public int Minor { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| int |  |

### Patch

Gets or sets the patch version.

#### Declaration

```csharp
public int Patch { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| int |  |

### Revision

Gets or sets the revision.

#### Declaration

```csharp
public int Revision { get; set; }
```

#### Property Value

| Type | Description |
| --- | --- |
| int |  |

## Methods

### CompareTo(FileVersion)

#### Declaration

```csharp
public int CompareTo(FileVersion other)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | other |  |

#### Returns

| Type | Description |
| --- | --- |
| int |  |

### Equals(FileVersion)

#### Declaration

```csharp
public bool Equals(FileVersion other)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | other |  |

#### Returns

| Type | Description |
| --- | --- |
| bool |  |

### Equals(object)

#### Declaration

```csharp
public override bool Equals(object obj)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| object | obj |  |

#### Returns

| Type | Description |
| --- | --- |
| bool |  |

### GetHashCode()

#### Declaration

```csharp
public override int GetHashCode()
```

#### Returns

| Type | Description |
| --- | --- |
| int |  |

### Parse(string)

Parses the file version string to a [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) object.

#### Declaration

```csharp
public static FileVersion Parse(string fileVersion)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| string | fileVersion | The file version. |

#### Returns

| Type | Description |
| --- | --- |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | A [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html). |

### ToString()

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

#### Declaration

```csharp
public override string ToString()
```

#### Returns

| Type | Description |
| --- | --- |
| string | The version. |

### TryParse(string, out FileVersion)

Tries to parse the `fileVersion`.

#### Declaration

```csharp
public static bool TryParse(string fileVersion, out FileVersion result)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| string | fileVersion | The file version. |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | result | The result. |

#### Returns

| Type | Description |
| --- | --- |
| bool | true if `result` was successfully set. false if `fileVersion` could not be parsed. |

## Operators

### operator ==(FileVersion, FileVersion)

Equals operator.

#### Declaration

```csharp
public static bool operator ==(FileVersion left, FileVersion right)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | left | Left operand. |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | right | Right operand. |

#### Returns

| Type | Description |
| --- | --- |
| bool | true if operator evaluates to true, false otherwise. |

### operator >(FileVersion, FileVersion)

Greater than operator.

#### Declaration

```csharp
public static bool operator >(FileVersion left, FileVersion right)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | left | Left operand. |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | right | Right operand. |

#### Returns

| Type | Description |
| --- | --- |
| bool | true if operator evaluates to true, false otherwise. |

### operator >=(FileVersion, FileVersion)

Greater or equals to operator.

#### Declaration

```csharp
public static bool operator >=(FileVersion left, FileVersion right)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | left | Left operand. |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | right | Right operand. |

#### Returns

| Type | Description |
| --- | --- |
| bool | true if operator evaluates to true, false otherwise. |

### operator !=(FileVersion, FileVersion)

Not equals operator.

#### Declaration

```csharp
public static bool operator !=(FileVersion left, FileVersion right)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | left | Left operand. |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | right | Right operand. |

#### Returns

| Type | Description |
| --- | --- |
| bool | true if operator evaluates to true, false otherwise. |

### operator <(FileVersion, FileVersion)

Less than operator.

#### Declaration

```csharp
public static bool operator <(FileVersion left, FileVersion right)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | left | Left operand. |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | right | Right operand. |

#### Returns

| Type | Description |
| --- | --- |
| bool | true if operator evaluates to true, false otherwise. |

### operator <=(FileVersion, FileVersion)

Less or equals to operator.

#### Declaration

```csharp
public static bool operator <=(FileVersion left, FileVersion right)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | left | Left operand. |
| [FileVersion](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.framework.essentials.versioning.fileversion.html) | right | Right operand. |

#### Returns

| Type | Description |
| --- | --- |
| bool | true if operator evaluates to true, false otherwise. |

### Implements

IEquatable<>
