.net - c# $ string in resource -


i need add $"test message {variable1} , {variable2}" kind of string resource file.
earlier can done using string builder format below

test message {0} , {1}   

let me know there alternative doing $ string format

$"test message {variable1} , {variable2}" syntactic sugar string.format("test message {0} , {1}", variable1, variable2).

you can put static values in resources. can't put dynamic values formatted string dynamic values.

if want use string interpolation this, need key resources formats , this:

string r(formattablestring fs) {     return string.format(resources.getstring(fs.format), fs.getarguments()); }  // uses "test message {0} , {1}" resource key r($"test message {variable1} , {variable2}"); 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -