<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>solutions.hans-eric.com &#187; C#.NET</title>
	<atom:link href="http://solutions.hans-eric.com/category/cnet/feed" rel="self" type="application/rss+xml" />
	<link>http://solutions.hans-eric.com</link>
	<description>Hans-Eric Grönlund's Log of Solutions to Technical Problems</description>
	<lastBuildDate>Thu, 22 Dec 2011 15:42:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding Linebreaks in C#</title>
		<link>http://solutions.hans-eric.com/adding-linebreaks-in-c</link>
		<comments>http://solutions.hans-eric.com/adding-linebreaks-in-c#comments</comments>
		<pubDate>Thu, 03 Sep 2009 12:33:01 +0000</pubDate>
		<dc:creator>Hans-Eric</dc:creator>
				<category><![CDATA[C#.NET]]></category>
		<category><![CDATA[string handling]]></category>

		<guid isPermaLink="false">http://solutions.hans-eric.com/?p=24</guid>
		<description><![CDATA[Problem:
We want to insert linebreak character sequences into a string in C#. 
Solution:
The platform safe way of doing this is by using the Environment.NewLine property.

msg = "An error occurred: " + Environment.NewLine + e.Message;

Composing a string with more than one line break can become really messy, so using string.Format might be a good idea.

msg = string.Format("{1} An [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong></p>
<p>We want to insert linebreak character sequences into a string in C#. </p>
<p><strong>Solution:</strong></p>
<p>The platform safe way of doing this is by using the Environment.NewLine property.</p>
<pre><code>
msg = "An error occurred: " + Environment.NewLine + e.Message;
</code></pre>
<p>Composing a string with more than one line break can become really messy, so using string.Format might be a good idea.</p>
<pre><code>
msg = string.Format("{1} An error occurred!{0}Exception: {0}{2}",
  Environment.NewLine, CurrentTime, e.ToString());
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://solutions.hans-eric.com/adding-linebreaks-in-c/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

