---
title: "Class MappingUtilities"
slug: "sdk--stylelabs.m.sdk.mappers.mappingutilities"
abstract: ""
---
# Class MappingUtilities

Provides some utilities for mapping.

## Inheritance

object

MappingUtilities

## Namespace: StylelabsStylelabs.MSdkMappers

## Assembly: Stylelabs.M.Sdk.dll

## Syntax

```csharp
public static class MappingUtilities
```

## Methods

### AddInvariantIfEmpty(IEnumerable<CultureInfo>)

Adds to a list of .

#### Declaration

```csharp
public static CultureInfo[] AddInvariantIfEmpty(IEnumerable<CultureInfo> cultures)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| IEnumerable<>CultureInfo | cultures | The cultures. |

#### Returns

| Type | Description |
| --- | --- |
| CultureInfo | The extended list of . |

### GetCulturesWithoutInvariant(IEnumerable<CultureInfo>)

Filters a list of by excluding .

#### Declaration

```csharp
public static CultureInfo[] GetCulturesWithoutInvariant(IEnumerable<CultureInfo> cultures)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| IEnumerable<>CultureInfo | cultures | The cultures. |

#### Returns

| Type | Description |
| --- | --- |
| CultureInfo | The filtered cultures. |

### MapLabels(IDictionary<CultureInfo, string>)

Maps cultures to labels.

#### Declaration

```csharp
public static Dictionary<string, string> MapLabels(IDictionary<CultureInfo, string> dict)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| IDictionary<, >CultureInfostring | dict | The cultures. |

#### Returns

| Type | Description |
| --- | --- |
| Dictionary<, >stringstring | The labels. |

### MapLabels(IDictionary<string, string>)

Maps labels to cultures.

#### Declaration

```csharp
public static IDictionary<CultureInfo, string> MapLabels(IDictionary<string, string> dict)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| IDictionary<, >stringstring | dict | The labels. |

#### Returns

| Type | Description |
| --- | --- |
| IDictionary<, >CultureInfostring | The cultures. |

### NullableToDate(DateTime?)

Coverts a nullable to a .

#### Declaration

```csharp
public static DateTime NullableToDate(DateTime? dateTime)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| DateTime | dateTime | The nullable . |

#### Returns

| Type | Description |
| --- | --- |
| DateTime | The . |

### NullableToId(long?)

Converts a nullable id to an id.

#### Declaration

```csharp
public static long NullableToId(long? id)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| long | id | An id. |

#### Returns

| Type | Description |
| --- | --- |
| long | A . |

### SdkCulturesToLoadOption(IEnumerable<CultureInfo>)

Creates a load option for the passed cultures, but does not check for invariant culture.

#### Declaration

```csharp
public static ICultureLoadOption SdkCulturesToLoadOption(IEnumerable<CultureInfo> cultures)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| IEnumerable<>CultureInfo | cultures | The cultures. |

#### Returns

| Type | Description |
| --- | --- |
| [ICultureLoadOption](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadoptions.icultureloadoption.html) | The [ICultureLoadOption](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.framework.essentials.loadoptions.icultureloadoption.html). |

### ToNullableDate(DateTime)

Converts a to a nullable . will be mapped to null.

#### Declaration

```csharp
public static DateTime? ToNullableDate(DateTime dateTime)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| DateTime | dateTime | A . |

#### Returns

| Type | Description |
| --- | --- |
| DateTime | A nullable . |

### ToNullableId(long)

Converts an id to a nullable id. 0 will be mapped to null.

#### Declaration

```csharp
public static long? ToNullableId(long id)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| long | id | An id. |

#### Returns

| Type | Description |
| --- | --- |
| long | A nullable . |
