---
title: "Class DirtyValueCalculator"
slug: "sdk--stylelabs.m.sdk.models.tracking.dirtyvaluecalculator"
abstract: ""
---
# Class DirtyValueCalculator

This class will check if values are dirty or not. Note however that this tracker only supports types that are supported in M:

- Primitives
- JTokens
- Collections of primitives

The goals is to have intelligent dirty tracking.

- If the value was set to A, then set to B and finally A again, then it should be marked not dirty.
- If the value was set to A, and B is a copy of A (reference is not the same), then it should be marked not dirty.

For optimal performance, try to prevent unnecessary IsDirty checks.

## Inheritance

object

DirtyValueCalculator

## Namespace: StylelabsStylelabs.MSdkStylelabs.M.Sdk.ModelsTracking

## Assembly: Stylelabs.M.Sdk.dll

## Syntax

```csharp
public class DirtyValueCalculator
```

## Properties

### CachedHashCode

Gets the cached has code.

#### Declaration

```csharp
public int? CachedHashCode { get; }
```

#### Property Value

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

## Methods

### IsDirty(object)

Checks if the object is dirty.

#### Declaration

```csharp
public bool IsDirty(object value)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| object | value | The value. |

#### Returns

| Type | Description |
| --- | --- |
| bool | true if dirty, false otherwise. |

### SetOriginalValue(object)

Sets the original value.

#### Declaration

```csharp
public void SetOriginalValue(object value)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| object | value | The value. |
