<?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 V - Using a library</title><link>http://blogs.msdn.com/b/lucabol/archive/2008/01/11/creating-an-immutable-value-object-in-c-part-v-using-a-library.aspx</link><description>Other posts: 
 Part I - Using a class 
 Part II - Making the class better 
 Part III - Using a struct 
 Part IV - A class with a special value 
 In the last post we presented a variation of implementing a value object using a class. Everything works</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>A C# library to write functional code - Part II - Tuples</title><link>http://blogs.msdn.com/b/lucabol/archive/2008/01/11/creating-an-immutable-value-object-in-c-part-v-using-a-library.aspx#8369981</link><pubDate>Wed, 09 Apr 2008 00:06:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8369981</guid><dc:creator>Luca Bolognese's WebLog</dc:creator><description>&lt;p&gt;Previous posts: Part I - Background Tuples are a way for you not to name things. In Object Oriented languages&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8369981" width="1" height="1"&gt;</description></item><item><title>re: Creating an immutable value object in C# - Part V - Using a library</title><link>http://blogs.msdn.com/b/lucabol/archive/2008/01/11/creating-an-immutable-value-object-in-c-part-v-using-a-library.aspx#7547378</link><pubDate>Sat, 09 Feb 2008 01:32:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7547378</guid><dc:creator>lucabol</dc:creator><description>&lt;p&gt;All these posts say is: iff you need an immutable class, here are a bunch of options of how to do it in C#.&lt;/p&gt;
&lt;p&gt;I don't think I'm claiming anything more than that. Am I?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7547378" width="1" height="1"&gt;</description></item><item><title>re: Creating an immutable value object in C# - Part V - Using a library</title><link>http://blogs.msdn.com/b/lucabol/archive/2008/01/11/creating-an-immutable-value-object-in-c-part-v-using-a-library.aspx#7546853</link><pubDate>Sat, 09 Feb 2008 00:53:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7546853</guid><dc:creator>qq</dc:creator><description>&lt;p&gt;I think you guys in immutable space have frankly lost it. It is not new, it is common principles that do not apply in all fields, and just because functional attempts are again popular you are hitting on attempting to solve a problem with a wrong tool: .net type system.&lt;/p&gt;
&lt;p&gt;If you think magically you will somehow parallelise code and algorithms, you are in for a big 'immutable surprise'.&lt;/p&gt;
&lt;p&gt;No, silver, bullet.. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7546853" width="1" height="1"&gt;</description></item><item><title>re: Creating an immutable value object in C# - Part V - Using a library</title><link>http://blogs.msdn.com/b/lucabol/archive/2008/01/11/creating-an-immutable-value-object-in-c-part-v-using-a-library.aspx#7493057</link><pubDate>Wed, 06 Feb 2008 19:02:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7493057</guid><dc:creator>lucabol</dc:creator><description>&lt;p&gt;It is an option. I wouldn't say it is better. It has pros and cons (i.e. readibility, amount of code, mantainability).&lt;/p&gt;
&lt;p&gt;As for me, I prefer library solutions to codegen whenever available (and roughly usable).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7493057" width="1" height="1"&gt;</description></item><item><title>Code generation</title><link>http://blogs.msdn.com/b/lucabol/archive/2008/01/11/creating-an-immutable-value-object-in-c-part-v-using-a-library.aspx#7488322</link><pubDate>Wed, 06 Feb 2008 13:25:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7488322</guid><dc:creator>Doekman</dc:creator><description>&lt;p&gt;Isn't code generation a much better option at this time, while 1st class readonly classes aren't available?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7488322" width="1" height="1"&gt;</description></item><item><title>re: Creating an immutable value object in C# - Part V - Using a library</title><link>http://blogs.msdn.com/b/lucabol/archive/2008/01/11/creating-an-immutable-value-object-in-c-part-v-using-a-library.aspx#7445322</link><pubDate>Mon, 04 Feb 2008 22:44:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7445322</guid><dc:creator>lucabol</dc:creator><description>&lt;p&gt;Yeah, you are right.&lt;/p&gt;
&lt;p&gt;We talked about having first class readonly classes a bunch of times, but we never came up with a proposal we are happy with. We are still discussing the topic.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7445322" width="1" height="1"&gt;</description></item><item><title>re: Creating an immutable value object in C# - Part V - Using a library</title><link>http://blogs.msdn.com/b/lucabol/archive/2008/01/11/creating-an-immutable-value-object-in-c-part-v-using-a-library.aspx#7444846</link><pubDate>Mon, 04 Feb 2008 22:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7444846</guid><dc:creator>mg</dc:creator><description>&lt;p&gt;Well, I was thinking about ValueObject more in terms of a type system base class, where you can put your additional behaviour and not spoil the Record class. You are right that still you cannot have a deeper hierarchy of types with this solution.&lt;/p&gt;
&lt;p&gt;BTW: don't you think it would be nice to have a language support for immutable types? Something like:&lt;/p&gt;
&lt;p&gt;public readonly class MyClass...&lt;/p&gt;
&lt;p&gt;where all fields are readonly fields of readonly types?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7444846" width="1" height="1"&gt;</description></item><item><title>re: Creating an immutable value object in C# - Part V - Using a library</title><link>http://blogs.msdn.com/b/lucabol/archive/2008/01/11/creating-an-immutable-value-object-in-c-part-v-using-a-library.aspx#7441648</link><pubDate>Mon, 04 Feb 2008 20:07:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7441648</guid><dc:creator>lucabol</dc:creator><description>&lt;p&gt;I think I'm missing something. Aren't you still stealing the base class with the ValueObject class?&lt;/p&gt;
&lt;p&gt;I.E. you cannot declare DateSpan to inherit from a MySpan class.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7441648" width="1" height="1"&gt;</description></item><item><title>re: Creating an immutable value object in C# - Part V - Using a library</title><link>http://blogs.msdn.com/b/lucabol/archive/2008/01/11/creating-an-immutable-value-object-in-c-part-v-using-a-library.aspx#7380365</link><pubDate>Sat, 02 Feb 2008 04:06:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7380365</guid><dc:creator>mg</dc:creator><description>&lt;p&gt;Nice work! &lt;/p&gt;
&lt;p&gt;One question about &amp;quot;stealing&amp;quot; the base class - what about introducing another layer of abstraction and instead of declaring your type like this:&lt;/p&gt;
&lt;p&gt;public class DateSpan: Record&amp;lt;DateTime, DateTime, bool&amp;gt; {...}&lt;/p&gt;
&lt;p&gt;do something like this:&lt;/p&gt;
&lt;p&gt;public class DateSpan: ValueObject&amp;lt;Record&amp;lt;DateTime, DateTime, bool&amp;gt;&amp;gt; {...}&lt;/p&gt;
&lt;p&gt;The ValueObject class would then expose the record to as a protected property and pass Equals, ToString... to the Record object. It would make the declarations a little bit more complicated, but your biggest drawback is not a problem anymore.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7380365" width="1" height="1"&gt;</description></item><item><title>Community Convergence XXXIX</title><link>http://blogs.msdn.com/b/lucabol/archive/2008/01/11/creating-an-immutable-value-object-in-c-part-v-using-a-library.aspx#7180738</link><pubDate>Mon, 21 Jan 2008 09:45:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7180738</guid><dc:creator>Charlie Calvert's Community Blog</dc:creator><description>&lt;p&gt;Welcome to the XXXIX issue of Community Convergence. The big news this week is that Microsoft has begun&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7180738" width="1" height="1"&gt;</description></item></channel></rss>