public static string quoteReplacement(string s){java.lang.StringBuilder result = new java.lang.StringBuilder(s.Length);{for (int i = 0; i < s.Length; i++){char c = s[i];if (c == '\\' || c == '$'){result.append('\\');}result.append(c);}}return result.ToString();}