Csharp Escape/Unescape
Form of C# Escaping/Unescaping
Enter Csharp or .NET code here to escape/unescape:
Move to «Paste Code» for Save it
About online C# escape/unescape
About Csharp escape/unescape
Escapes or unescapes a C# string removing traces of offending characters that could prevent compiling.
The Csharp Escape / Csharp Unescape tool was created to help with escape special unicode characters into a quoted string literal value for C# source code and also unescape it.
What characters are replaced?
The following characters are reserved in C# and must be properly escaped to be used in strings:
- Backspace is replaced with \b
- Newline is replaced with \n
- Tab is replaced with \t
- Carriage return is replaced with \r
- Form feed is replaced with \f
- Single quote is replaced with \'
- Double quote is replaced with \"
- Backslash is replaced with \\
How it Works?
Just paste your C# or .NET code to the textarea above and click to the button "Escape" or "Unescape" and you will get your escaped/unescaped data.
Example of C# Escaping
Csharp code, before:using System; namespace ExampleCode { class Program { public static void value(int num) { num++; } public static void reference(ref int num) { num++; } static void Main(string[] args) { int num; Console.Write("Enter a number:\t"); num = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("\n\n\tValue Type"); Console.WriteLine("----------------"); Console.Write("\nPrevious Value:\t{0}", num); Program.value(num); Console.Write("\nCurrent Value:\t{0}", num); Console.WriteLine("\n\n\n----------------"); Console.WriteLine("\tReference Type"); Console.WriteLine("--------------------"); Console.Write("\nPrevious Value:\t{0}", num); Program.reference(ref num); Console.Write("\nCurrent Value:\t{0}", num); Console.ReadLine(); } } }After:
using System;\r\nnamespace ExampleCode {\r\n\tclass Program {\r\n\t\tpublic static void value(int num) {\r\n\t\t\tnum++;\r\n\t\t}\r\n\t\tpublic static void reference(ref int num) {\r\n\t\t\tnum++;\r\n\t\t}\r\n\t\tstatic void Main(string[] args) {\r\n\t\t\tint num;\r\n\t\t\tConsole.Write(\"Enter a number:\\t\");\r\n\t\t\tnum = Convert.ToInt32(Console.ReadLine());\r\n\t\t\tConsole.WriteLine(\"\\n\\n\\tValue Type\");\r\n\t\t\tConsole.WriteLine(\"----------------\");\r\n\t\t\tConsole.Write(\"\\nPrevious Value:\\t{0}\", num);\r\n\t\t\tProgram.value(num);\r\n\t\t\tConsole.Write(\"\\nCurrent Value:\\t{0}\", num);\r\n\t\t\tConsole.WriteLine(\"\\n\\n\\n----------------\");\r\n\t\t\tConsole.WriteLine(\"\\tReference Type\");\r\n\t\t\tConsole.WriteLine(\"--------------------\");\r\n\t\t\tConsole.Write(\"\\nPrevious Value:\\t{0}\", num);\r\n\t\t\tProgram.reference(ref num);\r\n\t\t\tConsole.Write(\"\\nCurrent Value:\\t{0}\", num);\r\n\t\t\tConsole.ReadLine();\r\n\t\t}\r\n\t}\r\n}After the conversion, you can apply the C# code to your project or use it for some other purpose.