Key value pair source
Resolve a placeholder from a single KeyValuePair argument.
Read time 1 minuteLast updated 12 days ago
Resolve a placeholder from a single argument.
KeyValuePair<string, object>The Key value pair source handles a KeyValuePair<string, object> 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 and the value must be an . A pair with any other key or value type, such as , is not handled and the next source is tried. A value resolves to an empty string. Use the nullable operator () to return an empty result instead of an error when the value is .
stringobjectKeyValuePair<string, int>null{placeholder?.Anything}nullThe comparison is case-sensitive, so the selector must match the key exactly.
// "a value" Smart.Format("{placeholder}", new KeyValuePair<string, object>("placeholder", "a value"));
Smart String | Argument | Result |
|---|---|---|
| | a value |
| | (empty) |