I have a Dictionary<string,dynamic>
of key value pairs.
I also have a string script
in which I need to replace all occurrences of the key with corresponding value from the dictionary.
Eg : Contents of Dictionary :
Param1 : true
Param2 : "False"
Param3 : 123
Param4 : "1234"
String script = " I have Param1 and Param2 and Param3 and Param4 "
.
Now I wish to convert it to
script = " I have true and "False" and 123 and "1234" "
How can I achieve this ? I have tried script.Replace()
but it doesn't work for datatypes other than string
and if I use ToString()
for others , its capitalizing the Boolean
values.
Edit : I also went through this link Why does Boolean.ToString output "True" and not "true".