# Key value pair source

> Resolve a placeholder from a single KeyValuePair argument.

Resolve a placeholder from a single `KeyValuePair<string, object>` argument.

The Key value pair source handles a [KeyValuePair\<string, object>](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2) value. When the selector matches the pair's key, the source returns the pair's value. It is a lightweight way to supply one named value without building a dictionary.

The key must be a `string` and the value must be an `object`. A pair with any other key or value type, such as `KeyValuePair<string, int>`, is not handled and the next source is tried. A `null` value resolves to an empty string. Use the nullable operator (`{placeholder?.Anything}`) to return an empty result instead of an error when the value is `null`.

The comparison is case-sensitive, so the selector must match the key exactly.

```cs
// "a value"
            Smart.Format("{placeholder}", new KeyValuePair<string, object>("placeholder", "a value"));
```

| Smart String    | Argument                                                 | Result    |
| --------------- | -------------------------------------------------------- | --------- |
| `{placeholder}` | `KeyValuePair<string, object>("placeholder", "a value")` | a value   |
| `{placeholder}` | `KeyValuePair<string, object>("placeholder", null)`      | *(empty)* |

## Additional resources

* [Dictionary source](/engine/6000.7/manual/scripting/smart-strings/sources/dictionary-source.md)
* [Default source](/engine/6000.7/manual/scripting/smart-strings/sources/default-source.md)
* [Smart Strings](/engine/6000.7/manual/scripting/smart-strings.md)
