This problem comes to me when I was writing delimiter value in a XML config file, normally when you write a string like "\t" in XML config, parser class like XDocument will automatically convert it to @"\\t" so that you are getting a backslash and a 't' from the string that is parsed from the config. However, what I want is just a tab character rather than a two-character string.
So the problem turns into: given a string containing an escape sequence like "\t", how do I convert it into a one-character tab?
You can do something like this:
I wrote the following method to replace a bunch of common escape character sequences.