<?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 an immutable value object in C# - Part I - Using a class</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx</link><description>Other posts: Part II - Making the class better Part III - Using a struct Part IV - A class with a special value Value objects are objects for which the identity is based on their state instead of their pointer in memory. For example, a numeric Complex</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Creating an immutable value object in C# - Part I - Using a class</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#6675431</link><pubDate>Thu, 06 Dec 2007 09:13:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6675431</guid><dc:creator>AlexVB</dc:creator><description>&lt;p&gt;I am actually a little bit confused but I really belive that classes are reference objects in .NET; so naming &amp;quot;Creating immutable &amp;gt;&amp;gt;value objects&amp;lt;&amp;lt;....&amp;quot; looks a bit freak. Does not it?&lt;/p&gt;
&lt;p&gt;So in this case the only thing a developer must do is to properly implement base functionality, i mean base functions available in object class and just protect all the internal data the real object contains.... So the question is what do you really want to write about, new stuff about implementation of base object's functionality that is quite well covered by Rihter and other authors or something new. sorry if i am too rude :) i just really cant get the clue of the article&lt;/p&gt;
</description></item><item><title>Creating an immutable value object in C# - Part II - Making the class better</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#6682358</link><pubDate>Thu, 06 Dec 2007 20:34:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6682358</guid><dc:creator>Luca Bolognese's WebLog</dc:creator><description>&lt;p&gt;Other posts: Part I - Using a class In the previous post I showed how to trivially implement a value&lt;/p&gt;
</description></item><item><title>Creating an immutable value object in C# - Part II - Making the class better</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#6682591</link><pubDate>Thu, 06 Dec 2007 20:51:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6682591</guid><dc:creator>Noticias externas</dc:creator><description>&lt;p&gt;Other posts: Part I - Using a class In the previous post I showed how to trivially implement a value&lt;/p&gt;
</description></item><item><title>Brevity vs. Readability :)</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#6696772</link><pubDate>Fri, 07 Dec 2007 23:21:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6696772</guid><dc:creator>Kirill Osenkov</dc:creator><description>&lt;p&gt;One could probably replace&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if ((object)v2 == null)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return false;&lt;/p&gt;
&lt;p&gt;with&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return (object)v2 == null;&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (span.Intersect(other) == other)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return false;&lt;/p&gt;
&lt;p&gt;with&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return span.Intersect(other) == other;&lt;/p&gt;
&lt;p&gt;Just my 2 cents ;-)&lt;/p&gt;
</description></item><item><title>re: Creating an immutable value object in C# - Part I - Using a class</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#6791423</link><pubDate>Mon, 17 Dec 2007 21:07:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6791423</guid><dc:creator>Luca</dc:creator><description>&lt;p&gt;Yep, one certainly could :)&lt;/p&gt;
&lt;p&gt;I have always tended to state the obvious in my code. Once upon a time I thought it to be a bad thing. Now I think it is good.&lt;/p&gt;
&lt;p&gt;Maybe I'm just getting old ...&lt;/p&gt;
</description></item><item><title>This is standard practice from 1990 in C++ development </title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#6798098</link><pubDate>Tue, 18 Dec 2007 20:40:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6798098</guid><dc:creator>Greg</dc:creator><description>&lt;p&gt;Checklist for locking down an object:&lt;/p&gt;
&lt;p&gt;1. Object must be constructed with constructor arguments that initialize all fields. Default constructor is hidden (private). &amp;nbsp;A class factory with a hidden constructor works as well.&lt;/p&gt;
&lt;p&gt;2. Assignment operator does a deep copy of the object. &amp;nbsp;Member variables cannot be referred too by more than one object&lt;/p&gt;
&lt;p&gt;3. Equality tests both == and != must test member variables and not the object pointer/reference&lt;/p&gt;
&lt;p&gt;4. (optional) You cannot get a modifiable reference to the object (C++ only) or a pointer to the object&lt;/p&gt;
&lt;p&gt;5. Compound properties, consisting of 2 or more member variables, must be modified all at one time (i.e., may not be modified individually).&lt;/p&gt;
&lt;p&gt;6. (Allied Concept) Any data stored by the application must be accessible using stored procedures. &amp;nbsp;Do not access the tables directly.&lt;/p&gt;
&lt;p&gt;7. (Allied Concept) Allow multiple copies of the object but have them refer to the same static data (i.e. a single copy of the data usually encapsulated in a static object).&lt;/p&gt;
&lt;p&gt;This is standard practice in C++ from 1990 and even earlier than that in ADA and Smalltalk.&lt;/p&gt;
&lt;p&gt;It is a good practice, but should be used with restraint because the modularity and/or productivity gains are small for each object using this pattern. &amp;nbsp;Taking modularity higher, such as the business function or major functional module level, usually is more effective.&lt;/p&gt;
&lt;p&gt;Generally, over-emphasis on micro-modularity leads to longer development times and systems significantly harder to maintain.&lt;/p&gt;
</description></item><item><title>re: Creating an immutable value object in C# - Part I - Using a class</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#6854212</link><pubDate>Mon, 24 Dec 2007 20:38:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6854212</guid><dc:creator>fernando</dc:creator><description>&lt;p&gt;Immutable values are created as structs in c#, if you set a struct variable to another variable of the same type as in:&lt;/p&gt;
&lt;p&gt;struct1 var1 = new struct1(field1, field2);&lt;/p&gt;
&lt;p&gt;struct1 var2 = var1;&lt;/p&gt;
&lt;p&gt;var2 ends up being a deep copy of var1 stored on a seperate memory location. That's what an immutable type is, if you do that with your class, var2 will be a pointer to the same memory location where var1's value is stored, therefore it is NOT an immutable type.&lt;/p&gt;
&lt;p&gt;Incidentally, except for #4, #5 and #6 on Greg's checklist all other checklist items are true characteristics of a .NET structure. 1) Default constructor is hidden and ctor initializes all fields, 2) assignment operator does a deep copy of the object (as I mentioned above), 3) equality tests test the value, not the pointer, and 7) it allows multiple copies of the object but all of them refer to the same data.&lt;/p&gt;
</description></item><item><title>Creating an immutable value object in C# - Part III - Using a struct</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#6855827</link><pubDate>Tue, 25 Dec 2007 01:39:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6855827</guid><dc:creator>Luca Bolognese's WebLog</dc:creator><description>&lt;p&gt;Other posts: Part I - Using a class Part II - Making the class better In Part II I talked about the asymmetry&lt;/p&gt;
</description></item><item><title>Creating an immutable value object in C# - Part III - Using a struct</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#6855942</link><pubDate>Tue, 25 Dec 2007 02:01:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6855942</guid><dc:creator>Noticias externas</dc:creator><description>&lt;p&gt;Other posts: Part I - Using a class Part II - Making the class better In Part II I talked about the asymmetry&lt;/p&gt;
</description></item><item><title>Creating an immutable value object in C# - Part IV - A class with a special value</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#6889958</link><pubDate>Sat, 29 Dec 2007 02:45:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6889958</guid><dc:creator>Luca Bolognese's WebLog</dc:creator><description>&lt;p&gt;Other posts: Part I - Using a class Part II - Making the class better Part III - Using a struct In the&lt;/p&gt;
</description></item><item><title>Creating an immutable value object in C# - Part IV - A class with a special value</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#6890145</link><pubDate>Sat, 29 Dec 2007 03:06:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6890145</guid><dc:creator>Noticias externas</dc:creator><description>&lt;p&gt;Other posts: Part I - Using a class Part II - Making the class better Part III - Using a struct In the&lt;/p&gt;
</description></item><item><title>Creating an immutable value object in C# - Part V - Using a library</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#7077714</link><pubDate>Fri, 11 Jan 2008 21:36:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7077714</guid><dc:creator>Luca Bolognese's WebLog</dc:creator><description>&lt;p&gt;Other posts: Part I - Using a class Part II - Making the class better Part III - Using a struct Part&lt;/p&gt;
</description></item><item><title>Creating an immutable value object in C# - Part V - Using a library</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#7077899</link><pubDate>Fri, 11 Jan 2008 21:52:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7077899</guid><dc:creator>Noticias externas</dc:creator><description>&lt;p&gt;Other posts: Part I - Using a class Part II - Making the class better Part III - Using a struct Part&lt;/p&gt;
</description></item><item><title>Immutability in C#</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#7136481</link><pubDate>Thu, 17 Jan 2008 02:36:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7136481</guid><dc:creator>&lt;a href="http://weblogs.asp.net/bleroy"&gt;Tales from the Evil Empire&lt;/a&gt;</dc:creator><description>&lt;p&gt;For some reason, there's been a lot of buzz lately around immutability in C#. If you're interested in&lt;/p&gt;
</description></item><item><title>It's Time for a Change -- We need Immutable Types</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#8354378</link><pubDate>Thu, 03 Apr 2008 20:12:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8354378</guid><dc:creator>brute forced brilliance</dc:creator><description>&lt;p&gt;It's Time for a Change -- We need Immutable Types&lt;/p&gt;
</description></item><item><title>A C# library to write functional code - Part III - Records</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#8415055</link><pubDate>Mon, 21 Apr 2008 20:35:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8415055</guid><dc:creator>Luca Bolognese's WebLog</dc:creator><description>&lt;p&gt;Previous posts: Part I - Background Part II - Tuples Now that we know what Tuples are, we can start talking&lt;/p&gt;
</description></item><item><title>The Quest for Quick-and-Easy Class-Based Immutable Value Objects in C# - Part 1: Introduction</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#8572030</link><pubDate>Tue, 03 Jun 2008 22:37:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8572030</guid><dc:creator>adamjcooper.com/blog</dc:creator><description>&lt;p&gt;The Quest for Quick-and-Easy Class-Based Immutable Value Objects in C# - Part 1: Introduction&lt;/p&gt;
</description></item><item><title>The Quest for Quick-and-Easy Immutable Value Objects in C#</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx#8572136</link><pubDate>Tue, 03 Jun 2008 23:57:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8572136</guid><dc:creator>adamjcooper.com/blog</dc:creator><description>&lt;p&gt;The Quest for Quick-and-Easy Immutable Value Objects in C#&lt;/p&gt;
</description></item></channel></rss>