<?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 II - Making the class better</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx</link><description>Other posts: Part I - Using a class Part III - Using a struct Part IV - A class with a special value In the previous post I showed how to trivially implement a value object. The code works but it has several issues. Some are very simple, others are more</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Luca Bolognese's WebLog : Creating an immutable value object in C# - Part I - Using a class</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#6682386</link><pubDate>Thu, 06 Dec 2007 20:37:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6682386</guid><dc:creator>Luca Bolognese's WebLog : Creating an immutable value object in C# - Part I - Using a class</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx"&gt;http://blogs.msdn.com/lucabol/archive/2007/12/03/creating-an-immutable-value-object-in-c-part-i-using-a-class.aspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Creating an immutable value object in C# - Part II - Making the class better</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#6692347</link><pubDate>Fri, 07 Dec 2007 15:30:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6692347</guid><dc:creator>Tom Kirby-Green</dc:creator><description>&lt;p&gt;This is shaping up to be a very timely and useful mini series Luca :-) Please don't keep us waiting too long for the next part!&lt;/p&gt;
</description></item><item><title>re: Creating an immutable value object in C# - Part II - Making the class better</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#6825142</link><pubDate>Fri, 21 Dec 2007 10:46:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6825142</guid><dc:creator>Marcelo Cantos</dc:creator><description>&lt;p&gt;First off, the most practical representation of date spans is an inclusive lower bound and exclusive upper bound, i.e., [start, end). Equally important, they should be treated as points in time (which is what DateTime represents), not complete days. Thus, new DateTime(d, d) is empty for any d (solving empty ranges) and new DateTime(d, d.AddDays(1)) is exactly one day.&lt;/p&gt;
&lt;p&gt;Also, the type should really be DateTimeSpan.&lt;/p&gt;
&lt;p&gt;Convenience properties such as a static DateSpan.Empty would come in handy.&lt;/p&gt;
&lt;p&gt;Finally, DateTime has MaxValue and MinValue, which serve as fairly natural surrogates for +/- infinity, and also eliminate edge-cases from set operations.&lt;/p&gt;
</description></item><item><title>re: Creating an immutable value object in C# - Part II - Making the class better</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#6825145</link><pubDate>Fri, 21 Dec 2007 10:48:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6825145</guid><dc:creator>Marcelo Cantos</dc:creator><description>&lt;p&gt;Oops! Wherever I said 'new DateTime', I meant 'new DateSpan'.&lt;/p&gt;
</description></item><item><title>re: Creating an immutable value object in C# - Part II - Making the class better</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#6829034</link><pubDate>Fri, 21 Dec 2007 20:36:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6829034</guid><dc:creator>lucabol</dc:creator><description>&lt;p&gt;Thanks for the comment. It makes me think of something an old functional guy said once: &amp;quot;The idea of reusing objects across domain boundaries is absurd, not even something as simple as Person can be defined the same way in different domains&amp;quot;.&lt;/p&gt;
&lt;p&gt;In my domain (a stock backtesting app) a DateSpan needs to have a day boundary, not a point in time boundary. Also, inclusive lower and upper bounds have been working pretty well for my app so far (even if I can see that your definition has conceptual appeal).&lt;/p&gt;
&lt;p&gt;And anyhow, I'm just trying to show how to use some language features. I don't care much about the particular sample. I could have chosen Complex, but I thought it was too boring ...&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/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#6855828</link><pubDate>Tue, 25 Dec 2007 01:39:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6855828</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/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#6855943</link><pubDate>Tue, 25 Dec 2007 02:01:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6855943</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/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#6889959</link><pubDate>Sat, 29 Dec 2007 02:45:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6889959</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/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#6890146</link><pubDate>Sat, 29 Dec 2007 03:06:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6890146</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>re: Creating an immutable value object in C# - Part II - Making the class better</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#6893170</link><pubDate>Sat, 29 Dec 2007 08:54:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6893170</guid><dc:creator>kfarmer@microsoft.com</dc:creator><description>&lt;p&gt;Luca: Consider...&lt;/p&gt;
&lt;p&gt;public DateTime Start { get; private set; }&lt;/p&gt;
</description></item><item><title>re: Creating an immutable value object in C# - Part II - Making the class better</title><link>http://blogs.msdn.com/lucabol/archive/2007/12/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#6901500</link><pubDate>Sun, 30 Dec 2007 02:15:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6901500</guid><dc:creator>lucabol</dc:creator><description>&lt;p&gt;Hey Kit,&lt;/p&gt;
&lt;p&gt;Automatic properties don't prevent setting the property from inside the class. The readonly keyword does.&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/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#7077715</link><pubDate>Fri, 11 Jan 2008 21:36:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7077715</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/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#7077900</link><pubDate>Fri, 11 Jan 2008 21:52:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7077900</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/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#7136482</link><pubDate>Thu, 17 Jan 2008 02:36:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7136482</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>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/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#8572032</link><pubDate>Tue, 03 Jun 2008 22:37:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8572032</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/06/creating-an-immutable-value-object-in-c-part-ii-making-the-class-better.aspx#8572137</link><pubDate>Tue, 03 Jun 2008 23:57:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8572137</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>