If you have to do this often and you would like this to be cleaner in code you might like to have an extension method for this.
This is really obvious code, but still I think it can be useful to grab and make you save time.
///
/// Put a string between double quotes.
///
/// Value to be put between double quotes ex: foo
/// double quoted string ex: "foo"
public static string AddDoubleQuotes(this string value)
{
return "\"" + value + "\"";
}
Then you may call foo.AddDoubleQuotes() or "foo".AddDoubleQuotes(), on every string you like.
Hope this help.
No comments:
Post a Comment