Brian Reed wrote:
Is there a way to wrap String Literals in C# without using the ' + ' concatenation operator (or a StringBuilder)?
In C++ I could to the following:
{
SomeMethod("This is a really long string that I would want to screen wrap for "
"readability reasons. Notice I did not have to perform a string "
"concatenation to do this.");
}
Is there an equivalent in C#?
There doesn't seem to be... I miss that C feature, too.
The closest you'll get in C# is the @"..." literal strings. But, if you
do something like:
{
SomeMethod( @"This is a really long string that I would want
to screen wrap for readability reasons.
Notice I did not have to perform a string
concatenation to do this.");
}
It'll compile, but the string will contain all the newlines and extra
whitespace. This is great for embedding HTML which doesn't care about
the whitespace, but in general it's no good.
--
mikeb