<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Creating Immutable types</title><link>http://blogs.msdn.com/b/abhinaba/archive/2006/12/21/creating-immutable-types.aspx</link><description>Someone asked on a C# DL " How do I create an immutable type " 
 The answer was obviously by creating a type in which you don't allow writeable fields or properties or have methods that change the state of the type. However, the questions started revolving</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Creating Immutable types</title><link>http://blogs.msdn.com/b/abhinaba/archive/2006/12/21/creating-immutable-types.aspx#9823040</link><pubDate>Tue, 07 Jul 2009 21:41:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9823040</guid><dc:creator>j</dc:creator><description>&lt;p&gt;void Main(){&lt;/p&gt;
&lt;p&gt;var emp = new Employee(&amp;quot;bob&amp;quot;, 10000);&lt;/p&gt;
&lt;p&gt;MakeNull(emp);&lt;/p&gt;
&lt;p&gt;Console.WriteLine(emp.Name);//null reference exception&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;void MakeNull(Employee emp)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;emp = null;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;classes can't be truly immutable in C#&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9823040" width="1" height="1"&gt;</description></item><item><title>re: Creating Immutable types</title><link>http://blogs.msdn.com/b/abhinaba/archive/2006/12/21/creating-immutable-types.aspx#1345361</link><pubDate>Fri, 22 Dec 2006 09:35:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1345361</guid><dc:creator>Abhinaba Basu [MSFT]</dc:creator><description>&lt;p&gt;Oops missed readonly :(&lt;/p&gt;
&lt;p&gt;I have updated the code.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1345361" width="1" height="1"&gt;</description></item><item><title>re: Creating Immutable types</title><link>http://blogs.msdn.com/b/abhinaba/archive/2006/12/21/creating-immutable-types.aspx#1342561</link><pubDate>Fri, 22 Dec 2006 00:51:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1342561</guid><dc:creator>PBR</dc:creator><description>&lt;p&gt;Hmmm...why not use the readonly keyword on the name and salary fields?&lt;/p&gt;
&lt;p&gt;i.e.: readonly string salary;&lt;/p&gt;
&lt;p&gt;-- PBR&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1342561" width="1" height="1"&gt;</description></item></channel></rss>