So, I want to format a string using input parameter and not the index placeholders. Preferably I would like to use a Dictionary
. but I am not sure how to implement it.
var str = "I have {Bal} coins";
dictionary.Add("Bal", 20);
var output =
Expected Output: I have 20 coins.
I can use String format like below:
var str = "I have {0} coins";
var output = String.Format(str, 20);
My requirement is such that I need to use Dictionary.