<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Multi-Line Strings in C#</title>
	<atom:link href="http://jameskovacs.com/2007/02/12/multiline-strings-in-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://jameskovacs.com/2007/02/12/multiline-strings-in-c/</link>
	<description></description>
	<lastBuildDate>Wed, 01 Feb 2012 20:51:15 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: James</title>
		<link>http://jameskovacs.com/2007/02/12/multiline-strings-in-c/comment-page-1/#comment-32083</link>
		<dc:creator>James</dc:creator>
		<pubDate>Fri, 13 Jan 2012 18:46:27 +0000</pubDate>
		<guid isPermaLink="false">http://jameskovacs.com/2007/02/13/MultiLine+Strings+In+C#comment-32083</guid>
		<description>Speaking from personal experience, I often use string literals (@&quot;&quot;) for file paths, which on Windows use backslash characters. So using the same escape sequence in both cases would remove one of the most useful features of string literals.</description>
		<content:encoded><![CDATA[<p>Speaking from personal experience, I often use string literals (@&#8221;") for file paths, which on Windows use backslash characters. So using the same escape sequence in both cases would remove one of the most useful features of string literals.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anthony</title>
		<link>http://jameskovacs.com/2007/02/12/multiline-strings-in-c/comment-page-1/#comment-32082</link>
		<dc:creator>Anthony</dc:creator>
		<pubDate>Fri, 13 Jan 2012 18:33:59 +0000</pubDate>
		<guid isPermaLink="false">http://jameskovacs.com/2007/02/13/MultiLine+Strings+In+C#comment-32082</guid>
		<description>What is with MS?  Why is the escape sequence in c# \&quot; for a quote EXCEPT in lines declared with a @ ?  In this case the escape sequence is &quot;&quot;.

bah</description>
		<content:encoded><![CDATA[<p>What is with MS?  Why is the escape sequence in c# \&#8221; for a quote EXCEPT in lines declared with a @ ?  In this case the escape sequence is &#8220;&#8221;.</p>
<p>bah</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://jameskovacs.com/2007/02/12/multiline-strings-in-c/comment-page-1/#comment-15660</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Mon, 25 Jul 2011 12:58:13 +0000</pubDate>
		<guid isPermaLink="false">http://jameskovacs.com/2007/02/13/MultiLine+Strings+In+C#comment-15660</guid>
		<description>Thans, This was exactly what I was after!</description>
		<content:encoded><![CDATA[<p>Thans, This was exactly what I was after!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ash</title>
		<link>http://jameskovacs.com/2007/02/12/multiline-strings-in-c/comment-page-1/#comment-11108</link>
		<dc:creator>Ash</dc:creator>
		<pubDate>Wed, 11 May 2011 03:54:25 +0000</pubDate>
		<guid isPermaLink="false">http://jameskovacs.com/2007/02/13/MultiLine+Strings+In+C#comment-11108</guid>
		<description>James,

Forget about all the nitpickers.  I write a lot of stored procedures as well as in-line code using long SQL statements.  I keep my SQL statements always readable.  You have no idea, how thankful I am for a small but NEAT idea of keeping my in-line SQL statements sane!!!

Thank you!</description>
		<content:encoded><![CDATA[<p>James,</p>
<p>Forget about all the nitpickers.  I write a lot of stored procedures as well as in-line code using long SQL statements.  I keep my SQL statements always readable.  You have no idea, how thankful I am for a small but NEAT idea of keeping my in-line SQL statements sane!!!</p>
<p>Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stan</title>
		<link>http://jameskovacs.com/2007/02/12/multiline-strings-in-c/comment-page-1/#comment-10760</link>
		<dc:creator>Stan</dc:creator>
		<pubDate>Fri, 29 Apr 2011 13:06:11 +0000</pubDate>
		<guid isPermaLink="false">http://jameskovacs.com/2007/02/13/MultiLine+Strings+In+C#comment-10760</guid>
		<description>To further improve readability, you can also do it like this (and avoid all the whitespaces from indenting the text):

              string sql = &quot;&quot; +
@&quot;SELECT foo
FROM bar
WHERE baz=42&quot;;</description>
		<content:encoded><![CDATA[<p>To further improve readability, you can also do it like this (and avoid all the whitespaces from indenting the text):</p>
<p>              string sql = &#8220;&#8221; +<br />
@&#8221;SELECT foo<br />
FROM bar<br />
WHERE baz=42&#8243;;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://jameskovacs.com/2007/02/12/multiline-strings-in-c/comment-page-1/#comment-468</link>
		<dc:creator>James</dc:creator>
		<pubDate>Sat, 24 Apr 2010 18:02:09 +0000</pubDate>
		<guid isPermaLink="false">http://jameskovacs.com/2007/02/13/MultiLine+Strings+In+C#comment-468</guid>
		<description>@abhinav - You are correct that there is no perf hit using &quot;+&quot; as long as all strings are known at compile-time. Using @ will result in some bloat to your strings with the extra whitespace and new lines, but you would have to be dealing in some pretty extreme performance circumstances for this to matter. Premature optimization is the root of all evil. Write more maintainable code and then optimize the parts that a profiler tells you are actually slow, not the parts that you guess are slow. As developers, we almost always guess incorrectly.</description>
		<content:encoded><![CDATA[<p>@abhinav &#8211; You are correct that there is no perf hit using &#8220;+&#8221; as long as all strings are known at compile-time. Using @ will result in some bloat to your strings with the extra whitespace and new lines, but you would have to be dealing in some pretty extreme performance circumstances for this to matter. Premature optimization is the root of all evil. Write more maintainable code and then optimize the parts that a profiler tells you are actually slow, not the parts that you guess are slow. As developers, we almost always guess incorrectly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhinav</title>
		<link>http://jameskovacs.com/2007/02/12/multiline-strings-in-c/comment-page-1/#comment-459</link>
		<dc:creator>Abhinav</dc:creator>
		<pubDate>Fri, 23 Apr 2010 15:09:37 +0000</pubDate>
		<guid isPermaLink="false">http://jameskovacs.com/2007/02/13/MultiLine+Strings+In+C#comment-459</guid>
		<description>Using &quot;@&quot; is not necessarily good, since it increases the target string size. This could be an issue if your intention to span your string is only to increase its readability.

Using &quot;+&quot; not necessarily has Performance hit, it depends on how you use it. In the case of the following statement:

string sql = &quot;SELECT foo &quot; + 
                &quot;FROM bar &quot; +
                &quot;WHERE baz=42&quot;;

The COMPILER is smart enough to convert it in to one string at COMPILATION time, so there is not Performance hit of using &quot;+&quot; at RUNTIME. 
Don&#039;t believe me??, I thought so, so in order to confirm open the IL code of the generated code Assembly and you&#039;ll find that there is only ONE string. If you don&#039;t know how to read IL code, Use Reflector to see the IL code in C# to prove my point. 

The Output IL:
ldstr &quot;SELECT foo FROM bar WHERE baz=42&quot;


Take Away from story: 
                             &gt; Use + to span your strings in multiple lines for improving readability.
                             &gt; Use @ if your string has line breaks in it


Hope it helps!!
Abhinav</description>
		<content:encoded><![CDATA[<p>Using &#8220;@&#8221; is not necessarily good, since it increases the target string size. This could be an issue if your intention to span your string is only to increase its readability.</p>
<p>Using &#8220;+&#8221; not necessarily has Performance hit, it depends on how you use it. In the case of the following statement:</p>
<p>string sql = &#8220;SELECT foo &#8221; +<br />
                &#8220;FROM bar &#8221; +<br />
                &#8220;WHERE baz=42&#8243;;</p>
<p>The COMPILER is smart enough to convert it in to one string at COMPILATION time, so there is not Performance hit of using &#8220;+&#8221; at RUNTIME.<br />
Don&#8217;t believe me??, I thought so, so in order to confirm open the IL code of the generated code Assembly and you&#8217;ll find that there is only ONE string. If you don&#8217;t know how to read IL code, Use Reflector to see the IL code in C# to prove my point. </p>
<p>The Output IL:<br />
ldstr &#8220;SELECT foo FROM bar WHERE baz=42&#8243;</p>
<p>Take Away from story:<br />
                             &gt; Use + to span your strings in multiple lines for improving readability.<br />
                             &gt; Use @ if your string has line breaks in it</p>
<p>Hope it helps!!<br />
Abhinav</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yangxin</title>
		<link>http://jameskovacs.com/2007/02/12/multiline-strings-in-c/comment-page-1/#comment-245</link>
		<dc:creator>Yangxin</dc:creator>
		<pubDate>Wed, 12 Nov 2008 19:55:20 +0000</pubDate>
		<guid isPermaLink="false">http://jameskovacs.com/2007/02/13/MultiLine+Strings+In+C#comment-245</guid>
		<description>Yes, using &quot;+&quot; has performance hit. StringBuffer is not quite intuitive. @ is good.</description>
		<content:encoded><![CDATA[<p>Yes, using &quot;+&quot; has performance hit. StringBuffer is not quite intuitive. @ is good.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hai Vu</title>
		<link>http://jameskovacs.com/2007/02/12/multiline-strings-in-c/comment-page-1/#comment-244</link>
		<dc:creator>Hai Vu</dc:creator>
		<pubDate>Wed, 02 Apr 2008 15:09:30 +0000</pubDate>
		<guid isPermaLink="false">http://jameskovacs.com/2007/02/13/MultiLine+Strings+In+C#comment-244</guid>
		<description>I have come to love the @&quot; ... &quot; string when I worked on path names and regular expression. Now the multi-line feature makes me like it even more. By the way, your post comes up first when I google search for the phrase &quot;c# string span several lines&quot;.</description>
		<content:encoded><![CDATA[<p>I have come to love the @&quot; &#8230; &quot; string when I worked on path names and regular expression. Now the multi-line feature makes me like it even more. By the way, your post comes up first when I google search for the phrase &quot;c# string span several lines&quot;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vijay</title>
		<link>http://jameskovacs.com/2007/02/12/multiline-strings-in-c/comment-page-1/#comment-243</link>
		<dc:creator>vijay</dc:creator>
		<pubDate>Tue, 25 Mar 2008 16:44:13 +0000</pubDate>
		<guid isPermaLink="false">http://jameskovacs.com/2007/02/13/MultiLine+Strings+In+C#comment-243</guid>
		<description>By the way, you can also include double quotes as part of the string in the above mentioned method by providing 2 consecutive double quotes.

Example:

string myMultiLineString = @&quot;This line also contains &quot;&quot;double quotes&quot;&quot;, 
and also can continue to
multiple lines&quot;;</description>
		<content:encoded><![CDATA[<p>By the way, you can also include double quotes as part of the string in the above mentioned method by providing 2 consecutive double quotes.</p>
<p>Example:</p>
<p>string myMultiLineString = @&quot;This line also contains &quot;&quot;double quotes&quot;&quot;,<br />
and also can continue to<br />
multiple lines&quot;;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

