<?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>Emmer Inc &#187; Dictionary</title>
	<atom:link href="http://blog.emmerinc.be/index.php/tag/dictionary/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.emmerinc.be</link>
	<description>Tales from a .NET developer who's making the jump to the iPhone &#38; App Store wonderland.</description>
	<lastBuildDate>Mon, 06 Sep 2010 19:43:52 +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>One line initialization of a Dictionary</title>
		<link>http://blog.emmerinc.be/index.php/2009/03/07/one-line-initialization-of-a-dictionary/</link>
		<comments>http://blog.emmerinc.be/index.php/2009/03/07/one-line-initialization-of-a-dictionary/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 14:55:07 +0000</pubDate>
		<dc:creator>Yannick Compernol</dc:creator>
				<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[Dictionary]]></category>

		<guid isPermaLink="false">http://blog.emmerinc.be/?p=126</guid>
		<description><![CDATA[The .NET 3.5 Framework not only brought us the Windows Communication &#038; Presentation Foundation, it also contained an update of C# to version 3.0. With the celebrated lambda and var functionality.
One of the most useful features it introduced is/was one line initialization. A list of strings can be declared and initialized using the following line:

var [...]]]></description>
			<content:encoded><![CDATA[<p>The .NET 3.5 Framework not only brought us the Windows <a href="http://msdn.microsoft.com/en-us/netframework/aa663324.aspx">Communication</a> &#038; <a href="http://msdn.microsoft.com/en-us/netframework/aa663326.aspx">Presentation</a> Foundation, it also contained an update of C# to version <a href="http://en.wikipedia.org/wiki/C_Sharp_(programming_language)#Features_of_C.23_3.0">3.0</a>. With the celebrated lambda and var functionality.</p>
<p>One of the most useful features it introduced is/was one line initialization. A list of strings can be declared and initialized using the following line:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">var list <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #666666;">&quot;String1&quot;</span>, <span style="color: #666666;">&quot;String2&quot;</span>, <span style="color: #666666;">&quot;String3&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Luckily this feature is not limited to simple lists. A dictionary can be declared and initialized using the same approach:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">var dictionary <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span>, <span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #666666;">&quot;Key1&quot;</span>, <span style="color: #666666;">&quot;Value1&quot;</span> <span style="color: #000000;">&#125;</span>, <span style="color: #000000;">&#123;</span> <span style="color: #666666;">&quot;Key2&quot;</span>, <span style="color: #666666;">&quot;Value2&quot;</span> <span style="color: #000000;">&#125;</span>, <span style="color: #000000;">&#123;</span> <span style="color: #666666;">&quot;Key3&quot;</span>, <span style="color: #666666;">&quot;Value3&quot;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span></pre></div></div>

<p>I have used this extensively with lists, but only recently discovered this was possible with dictionaries.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.emmerinc.be/index.php/2009/03/07/one-line-initialization-of-a-dictionary/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
