Dictionary source
The Dictionary source extracts objects with a matching Key from an IDictionary or IDictionary<string, object>.
When evaluating an IDictionary, if the Key is not a string, the Dictionary source first converts it to a string using the object’s ToString method. The case sensitivity of the comparison is determined by the Smart Form Case Sensitivity option.
Example Smart String | Arguments | Result |
---|---|---|
{SomeKey} |
|
999 |
Hello {Name} {Surname} |
|
Hello Gordon Freeman |
{Name} {Surname} scored {1:Score} points |
|
Gordon Freeman scored 153 points |
The following example shows how a dictionary could be provided as an argument.
var localizedString = new LocalizedString("My Table", "My Table Entry");
var dict = new Dictionary<string, string> { { "Name", "Gordon" }, { "Surname", "Freeman" } };
localizedString.Arguments = new object[] { dict };