public static string Quote(this string s) { Regex doubleQuotedString = new Regex("\"[^\\\"]*(\\.[^\\\"]*)*\""); if( !doubleQuotedString.IsMatch(s) ) { string quote = "\""; return quote + s + quote; } return s; }