public static string Interpolate(
this string format,
IEnumerable<KeyValuePair<string, Object>> parameters
)
<ExtensionAttribute>
Public Shared Function Interpolate (
format As String,
parameters As IEnumerable(Of KeyValuePair(Of String, Object))
) As String
public:
[ExtensionAttribute]
static String^ Interpolate(
String^ format,
IEnumerable<KeyValuePair<String^, Object^>>^ parameters
)
Gemstone.StringExtensions.StringExtensions.Interpolate = function(format, parameters);
This overload is intended to be used for scenarios in which the parameters available to the format string are stored in a DictionaryTKey, TValue or ExpandoObject. Note that dynamic variables cannot be used when calling extension functions.
string format = "{hello} {world}!";
dynamic parameters = new ExpandoObject();
parameters.hello = "Hello";
parameters.world = "World";
Console.WriteLine(format.Interpolate(parameters)); // This raises a compiler error
Console.WriteLine(format.Interpolate((ExpandoObject)parameters); // This is okay
Console.WriteLine(StringExtensions.Interpolate(format, parameters); // This is also okay