when single cot add backslash C# code example Example: c# handle single quote inside string s = s.Replace("'", "\\'")