If I have a string that contains a c# string literal expression can I “expand” it at runtime
public void TestEvaluateString()
{
string Dummy = EvalString( @"Contains \r\n new line");
Debug.Assert(Dummy == "Contains \r\n new line");
}
private string EvalString(string input)
{
return "Contains \r\n new line";
}
Like Can I convert a C# string value to an escaped string literal, but in reverse?
Similar to Mikael answer but using the CSharpCodeProvider:
You might be better off using a dictionary of wildcards and just replacing them in the string.