---
title: "Interface IPropertyBag"
slug: "scripting--stylelabs.m.scripting.types.v1_0.action.ipropertybag"
abstract: ""
---
# Interface IPropertyBag

Defines simple property bag which stores langword_csharp_string properties associated with langword_csharp_string keys.

## Namespace: StylelabsStylelabs.MStylelabs.M.ScriptingStylelabs.M.Scripting.TypesStylelabs.M.Scripting.Types.V1_0Action

## Assembly: Stylelabs.M.Scripting.Types.dll

## Syntax

```csharp
public interface IPropertyBag
```

## Properties

### this\[string\]

Gets or sets the value associated with the given `key`.

#### Declaration

```csharp
string this[string key] { get; set; }
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| string | key | The key to get the value for. |

#### Property Value

| Type | Description |
| --- | --- |
| string | The value associated with the given `key`. If the value's not there, null is returned. |

## Methods

### Add(string, string)

Add specified value or override existing one.

#### Declaration

```csharp
string Add(string key, string addValue)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| string | key | The key. |
| string | addValue | The value. |

#### Returns

| Type | Description |
| --- | --- |
| string | Added value. |

### ContainsKey(string)

Checks if the [IPropertyBag](https://doc.sitecore.com/ch/en/developers/api-reference/scripting--stylelabs.m.scripting.types.v1_0.action.ipropertybag.html) contains an entry for the given `key`.

#### Declaration

```csharp
bool ContainsKey(string key)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| string | key | The key to check. |

#### Returns

| Type | Description |
| --- | --- |
| bool | true if the bag contains an entry for the given `key`; otherwise false. |

### Remove(string)

Tries to removes the entry with the specified `key` from the property-bag. If the entry doesn't exist, nothing will happen.

#### Declaration

```csharp
bool Remove(string key)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| string | key | The key to remove. |

#### Returns

| Type | Description |
| --- | --- |
| bool | true if entry's been removed, meaning the property-bag contained an entry wit the given `key`; otherwise false. |

### TryGetValue(string, out string)

Attempts to get the value associated with specified `key`.

#### Declaration

```csharp
bool TryGetValue(string key, out string value)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| string | key | The key. |
| string | value | The value. |

#### Returns

| Type | Description |
| --- | --- |
| bool | true if the value was returned. |
