Hi Guys, The below code used to interpolate the string and it is configured in the coding itself.
string Name = "Sakthi";
Console.WriteLine($"Name: {Name}");
Output:
Name: Sakthi
My Need is, I want to configure the interpolation expression in the configuration file and need to show the result after interpolation.
Configuration:
<add key="dataToInterpolate" value="Name: {Name}"/>
Code:
Console.WriteLine(configurationManager.AppSettings["dataToInterpolate"]);
Expected Result:
Name: Sakthi
For this, We can use string.Format() method. But we want to supply the value explicitly. I am trying to do it dynamically like angular js binding. Can anyone help on this.