<?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>Immutable is, the new Anonymous Type</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx</link><description>Overview In the spirit of keeping my first post short and simple, i plan to write about changes to Anonymous tyes that will be of interest to quite a few developers. Anonymous types are immutable, yes its true. Now depending on your current project, prevaling</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Immutable is, the new Anonymous Type</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#2128045</link><pubDate>Sat, 14 Apr 2007 10:27:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2128045</guid><dc:creator>zproxy</dc:creator><description>&lt;p&gt;Nah, the post is just great :)&lt;/p&gt;
&lt;p&gt;By the way in LINQ May the initializer syntax was unable to initiate a generic type like this:&lt;/p&gt;
&lt;p&gt;new Foo&amp;lt;int&amp;gt; {&lt;/p&gt;
&lt;p&gt;bar = 0&lt;/p&gt;
&lt;p&gt;};&lt;/p&gt;
&lt;p&gt;But i guess this is or will be fixed, right? &lt;/p&gt;
</description></item><item><title>re: Immutable is, the new Anonymous Type</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#2148404</link><pubDate>Mon, 16 Apr 2007 03:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2148404</guid><dc:creator>Jules</dc:creator><description>&lt;p&gt;The decision seems smart to me.&lt;/p&gt;
&lt;p&gt;Could you expand more on why you've only now decided to make this decision instead of earlier?&lt;/p&gt;
&lt;p&gt;Could you also explain any performance implications of this decision?&lt;/p&gt;
</description></item><item><title>re: Immutable is, the new Anonymous Type</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#2166533</link><pubDate>Wed, 18 Apr 2007 00:34:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2166533</guid><dc:creator>Sree_c</dc:creator><description>&lt;p&gt;Yes, intializer syntax with generic types will work... though there is no type inference so&lt;/p&gt;
&lt;p&gt;var v = new Foo&amp;lt;int&amp;gt; { bar = 0 }; // will work&lt;/p&gt;
&lt;p&gt;var v1 = new Foo { bar = 1 }; // won't work&lt;/p&gt;
&lt;p&gt;Sree&lt;/p&gt;
</description></item><item><title>re: Immutable is, the new Anonymous Type</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#2167212</link><pubDate>Wed, 18 Apr 2007 03:35:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2167212</guid><dc:creator>Sree_c</dc:creator><description>&lt;p&gt;I think the simple reason we did not do this early is probably because we did not foresee all the issues, and there are always requests from customer to do interesting with anonymous types :).&lt;/p&gt;
&lt;p&gt;The Performace implication is are that &lt;/p&gt;
&lt;p&gt;1. Its a single call (ctor) instead of ctor and initializers.&lt;/p&gt;
&lt;p&gt;2. Possible limitation on the number of arguments that a constructor can take ... none discovered.&lt;/p&gt;
</description></item><item><title>Community Convergence XXV</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#2221789</link><pubDate>Sat, 21 Apr 2007 20:09:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2221789</guid><dc:creator>Charlie Calvert's Community Blog</dc:creator><description>&lt;p&gt;Visual Studio Orcas Beta 1 is available for download . Though quite similar to the March CTP in terms&lt;/p&gt;
</description></item><item><title>re: Immutable is, the new Anonymous Type</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#2258138</link><pubDate>Tue, 24 Apr 2007 11:46:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2258138</guid><dc:creator>Herman</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I was wondering wether the immutable new &lt;/p&gt;
&lt;p&gt;anonymous type has a constructor with the same anonymous type as an argument.&lt;/p&gt;
&lt;p&gt;Like:&lt;/p&gt;
&lt;p&gt;var v = new { A = 5, b = &amp;quot;bar&amp;quot; };&lt;/p&gt;
&lt;p&gt;var v1 = new {v}&lt;/p&gt;
&lt;p&gt;Which should translate to:&lt;/p&gt;
&lt;p&gt;var v = new AnonymousType&amp;lt;int, string&amp;gt;(5,&amp;quot;bar&amp;quot;);&lt;/p&gt;
&lt;p&gt;var v1 = new AnonymousType&amp;lt;int,string&amp;gt;(v);&lt;/p&gt;
&lt;p&gt;So that the anonymousType class has a constructor with the same &amp;nbsp;anonymousType &amp;nbsp;as an argument.&lt;/p&gt;
</description></item><item><title>re: Immutable is, the new Anonymous Type</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#2258233</link><pubDate>Tue, 24 Apr 2007 11:56:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2258233</guid><dc:creator>Herman</dc:creator><description>&lt;p&gt;To clearyfy my last remark:&lt;/p&gt;
&lt;p&gt;The AnonymousType&amp;lt;int,string&amp;gt; defined&lt;/p&gt;
&lt;p&gt;by specifying/inferring the types and names of its parameters.&lt;/p&gt;
&lt;p&gt;Does this type also has a constructor with&lt;/p&gt;
&lt;p&gt;a single argument of type AnonymousType&amp;lt;int,string&amp;gt;&lt;/p&gt;
&lt;p&gt;like so&lt;/p&gt;
&lt;p&gt;class AnonymousType&amp;lt;int,string&amp;gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp;private int _a;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;private string _s;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;public AnonymousType(int a,string s){&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; _a=a;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; _s=s; &lt;/p&gt;
&lt;p&gt; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp;public AnonymousType( &amp;nbsp; AnonymousType&amp;lt;int,string&amp;gt; source){&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; _a=source._a;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; _s=source._s; &lt;/p&gt;
&lt;p&gt; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp;... other members ... &lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
</description></item><item><title>re: Immutable is, the new Anonymous Type</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#2264965</link><pubDate>Wed, 25 Apr 2007 00:57:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2264965</guid><dc:creator>Sree_c</dc:creator><description>&lt;p&gt;There are no current plans to have copy constructor for the Anonymous Types.&lt;/p&gt;
&lt;p&gt;Could you explain the reasoning behind this. &lt;/p&gt;
&lt;p&gt;Since the Instance are immutable having a copy does not buy much.&lt;/p&gt;
&lt;p&gt;Creating another instance of the anonymous types which is a copy involves knowing the names/values/order of the arguments, these should be avaiable if the new instance is created in the same method as the first.&lt;/p&gt;
&lt;p&gt;var v = new { A = 5, b = &amp;quot;bar&amp;quot; };&lt;/p&gt;
&lt;p&gt;var v1 = new { A = 5, b = &amp;quot;bar&amp;quot; };&lt;/p&gt;
&lt;p&gt;v.Equals(v1);&lt;/p&gt;
&lt;p&gt;Anonymous types escape functions only as type &amp;quot;System.Object&amp;quot;.&lt;/p&gt;
</description></item><item><title>Anonymous method remain mutable in VB. </title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#2555951</link><pubDate>Sat, 12 May 2007 02:52:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2555951</guid><dc:creator>@ Head</dc:creator><description>&lt;p&gt;Paul Vick posted that anonymous types will remain mutable in VB . Generally this looks good, I just hope&lt;/p&gt;
</description></item><item><title>re: Immutable is, the new Anonymous Type</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#2578160</link><pubDate>Sat, 12 May 2007 23:03:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2578160</guid><dc:creator>Fabrice Marguerie</dc:creator><description>&lt;p&gt;After reading Paul Vick's post, I'm not sure whether anonymous types will be mutable or not.&lt;/p&gt;
&lt;p&gt;Could clear this up, please?&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.panopticoncentral.net/archive/2007/05/11/20566.aspx"&gt;http://www.panopticoncentral.net/archive/2007/05/11/20566.aspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>VB.NET to the rescue</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#2633006</link><pubDate>Mon, 14 May 2007 23:58:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2633006</guid><dc:creator>Claudio Brotto</dc:creator><description>&lt;p&gt;Ho sempre sostenuto che VB.NET fosse un linguaggio creato pi&amp;#249; per ragioni di mercato che per reali necessit&amp;#224;&lt;/p&gt;
</description></item><item><title>re: Immutable is, the new Anonymous Type</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#4880341</link><pubDate>Wed, 12 Sep 2007 17:38:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4880341</guid><dc:creator>george moudry</dc:creator><description>&lt;p&gt;Immutable anonymous types are now implemented in DB_Linq - a LINQ provider for MySql, Oracle and Postgres&lt;/p&gt;
</description></item><item><title>Debugging C# 3.0 Part II</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#6603434</link><pubDate>Fri, 30 Nov 2007 00:57:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6603434</guid><dc:creator>Sree's ventures in code space</dc:creator><description>&lt;p&gt;Overview In the last article I covered the &amp;amp;quot;results view&amp;amp;quot; for lazy evaluated collections like&lt;/p&gt;
</description></item><item><title>我眼中的C# 3.0 </title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#8576544</link><pubDate>Fri, 06 Jun 2008 02:41:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8576544</guid><dc:creator>冰封的心</dc:creator><description>&lt;p&gt;你是如何创建属性的？&lt;/p&gt;
&lt;p&gt;如果你长期使用C#，相信你不会对属性这个东西感到陌生。一般地，属性是对私有字段的一个简单包装，就像这样： 代码1&lt;/p&gt;
&lt;p&gt;使用属性而不是直接公开私有字段的一个好处就是...&lt;/p&gt;
</description></item><item><title>我眼中的C# 3.0 </title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#8579410</link><pubDate>Sat, 07 Jun 2008 06:25:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8579410</guid><dc:creator>lemontree</dc:creator><description>&lt;p&gt;转自：&lt;a rel="nofollow" target="_new" href="http://allenlooplee.cnblogs.com/"&gt;http://allenlooplee.cnblogs.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;缘起&lt;/p&gt;
&lt;p&gt;每次有新技术发布时，我们总能感受到两种截然不同的情绪：一种是恐惧和抵抗，伴随着这种情绪的还有诸如&lt;/p&gt;
</description></item><item><title>我眼中的C# 3.0 </title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#8679627</link><pubDate>Wed, 02 Jul 2008 05:31:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8679627</guid><dc:creator>眼里无神</dc:creator><description>&lt;p&gt;缘起&lt;/p&gt;
&lt;p&gt;每次有新技术发布时，我们总能感受到两种截然不同的情绪：&lt;/p&gt;
&lt;p&gt;一种是恐惧和抵抗，伴随着这种情绪的还有诸如&lt;/p&gt;
</description></item><item><title>我眼中的C# 3.0</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#8962045</link><pubDate>Tue, 23 Sep 2008 11:39:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8962045</guid><dc:creator>joinger</dc:creator><description>&lt;p&gt;每次有新技术发布时，我们总能感受到两种截然不同的情绪：&lt;/p&gt;
&lt;p&gt;一种是恐惧和抵抗，伴随着这种情绪的还有诸如&lt;/p&gt;
</description></item><item><title>C#3.0新增特性</title><link>http://blogs.msdn.com/sreekarc/archive/2007/04/03/immutable-the-new-anonymous-type.aspx#9515685</link><pubDate>Sat, 28 Mar 2009 10:17:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9515685</guid><dc:creator>hk_king</dc:creator><description>&lt;p&gt;文章出处：&lt;a rel="nofollow" target="_new" href="http://www.cnblogs.com/allenlooplee/archive/2008/06/01/1211520.html"&gt;http://www.cnblogs.com/allenlooplee/archive/2008/06/01/1211520.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;缘起&lt;/p&gt;
&lt;p&gt;每次有新技术发布时，我们总能感受到两种截然...&lt;/p&gt;
</description></item></channel></rss>