<?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>Why No Extension Properties?</title><link>http://blogs.msdn.com/b/ericlippert/archive/2009/10/05/why-no-extension-properties.aspx</link><description>I'm frequently asked "you guys added extension methods to C# 3, so why not add extension properties as well?" 
 Good question. 
 First, let me talk a bit about C# 3. Clearly the big feature in C# 3 was LINQ. In a sense we had only three features in</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Why No Extension Properties?</title><link>http://blogs.msdn.com/b/ericlippert/archive/2009/10/05/why-no-extension-properties.aspx#10305752</link><pubDate>Wed, 16 May 2012 09:54:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10305752</guid><dc:creator>George Birbilis</dc:creator><description>&lt;p&gt;being able to add more constructors via extension methods would save a lot of time to people trying to create for example compatibility layers for porting WPF code to Silverlight (e.g. at ScaleTransform of Silverlight I&amp;#39;m missing a constructor that takes ScaleX and ScaleY params, forcing one to rewrite their WPF code to not pass such params but do set ScaleX/ScaleY explicitly if they want it portable to SL)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10305752" width="1" height="1"&gt;</description></item><item><title>re: Why No Extension Properties?</title><link>http://blogs.msdn.com/b/ericlippert/archive/2009/10/05/why-no-extension-properties.aspx#10285415</link><pubDate>Tue, 20 Mar 2012 13:09:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10285415</guid><dc:creator>Pete</dc:creator><description>&lt;p&gt;&amp;gt; Properties are meant to store some kind of state in relation to the instance of the object it exists on.&lt;/p&gt;
&lt;p&gt;If you´re referring to setters. But there are lots of cases where you can use getters that return the result of, say, some calcs on the fly not having to access private fields.&lt;/p&gt;
&lt;p&gt;Would have loved to see this feature on C# 5 ... :(&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10285415" width="1" height="1"&gt;</description></item><item><title>re: Why No Extension Properties?</title><link>http://blogs.msdn.com/b/ericlippert/archive/2009/10/05/why-no-extension-properties.aspx#10241548</link><pubDate>Fri, 25 Nov 2011 14:39:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10241548</guid><dc:creator>Michael Perrenoud</dc:creator><description>&lt;p&gt;To all of those who wonder why extension properties aren&amp;#39;t just an extension of extension methods let&amp;#39;s examine the purpose of a property first. &amp;nbsp;Properties are meant to store some kind of state in relation to the instance of the object it exists on. &amp;nbsp;Extension methods store no state on the object itself, rather they simply interrogate the object and add some additional functionality. &amp;nbsp;They may in fact set values of properties that already exist in the objects definition, but they aren&amp;#39;t storing any new dynamic state.&lt;/p&gt;
&lt;p&gt;In contract extension properties would need to store state on that object, dynamically. &amp;nbsp;Now, if you come from working in dynamic languages this may seem silly to you because you can modify objects and definitions at will, however the .NET framework is not a dynamic framework, it&amp;#39;s typed and defined, and security plays a big role in that.&lt;/p&gt;
&lt;p&gt;So, by saying that extension properties are simply an extension of extension methods you are implying that the .NET framework should have the right to simply modify an object&amp;#39;s IL at will. &amp;nbsp;I think that would be a pretty clear violation of security because now the .NET framework would be acting in a malicious manner, abstractly speaking.&lt;/p&gt;
&lt;p&gt;Please remember that Microsoft must solve problems on a different level than what we consume them. &amp;nbsp;Until they come up with a solution that works well, why don&amp;#39;t you use a very basic workaround. &amp;nbsp;Build a static generic cache object that will store state in a dictionary and then in the extension method get and set against that cache and BAM you have an extension property.&lt;/p&gt;
&lt;p&gt;So, in short (or maybe long) I think you might be able to see why Foo of type T isn&amp;#39;t just building get_Foo(T) and set_Foo(T).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10241548" width="1" height="1"&gt;</description></item><item><title>re: Why No Extension Properties?</title><link>http://blogs.msdn.com/b/ericlippert/archive/2009/10/05/why-no-extension-properties.aspx#10235929</link><pubDate>Thu, 10 Nov 2011 20:24:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10235929</guid><dc:creator>Avi</dc:creator><description>&lt;p&gt;Candid! We all do mistakes...&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10235929" width="1" height="1"&gt;</description></item><item><title>re: Why No Extension Properties?</title><link>http://blogs.msdn.com/b/ericlippert/archive/2009/10/05/why-no-extension-properties.aspx#10211777</link><pubDate>Thu, 15 Sep 2011 15:55:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10211777</guid><dc:creator>Stephen</dc:creator><description>&lt;p&gt;With the next release of Visual Studio (2011) and .NET 4.5 in preview, I got to wondering what the status of this feature is. &amp;nbsp;I know that WPF is kind of deprecated in favor of HTML 5. &amp;nbsp;But this would be useful in more things than just WPF (and for those not wanting to jump on the HTML 5 bandwagon, it would be great!)&lt;/p&gt;
&lt;p&gt;Any chance the next release of Visual Studio will have a C# 4.5 in it? &amp;nbsp;Will this feature be in it?&lt;/p&gt;
&lt;div class="yellowbox"&gt;
&lt;p&gt;WPF is not deprecated. We have no plans to do extension properties. The majority of the development work is dedicated to getting asynchrony working and of course all the changes necessary to support a rich WinRT experience in C# and VB. We are not discussing ship vehicles or schedules at this time. -- Eric&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10211777" width="1" height="1"&gt;</description></item><item><title>re: Why No Extension Properties?</title><link>http://blogs.msdn.com/b/ericlippert/archive/2009/10/05/why-no-extension-properties.aspx#10182763</link><pubDate>Mon, 04 Jul 2011 02:00:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10182763</guid><dc:creator>Chris Moschini</dc:creator><description>&lt;p&gt;BitFlipper does a great job of designing extension properties, constructors, operators, and methods here:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://channel9.msdn.com/Forums/Coffeehouse/257556-C-Extension-Properties?page=3#cea353ba831fa49a5a8bd9f160020664f"&gt;channel9.msdn.com/.../257556-C-Extension-Properties&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I propose that design be used in the next version of C#. It requires moving on from the existing implementation, but it&amp;#39;s much more natural, and makes the path forward obvious.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10182763" width="1" height="1"&gt;</description></item><item><title>re: Why No Extension Properties?</title><link>http://blogs.msdn.com/b/ericlippert/archive/2009/10/05/why-no-extension-properties.aspx#10147022</link><pubDate>Tue, 29 Mar 2011 08:21:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10147022</guid><dc:creator>Matthew Brand</dc:creator><description>&lt;p&gt;I would love to see extension properties, if only to pretty my code by getting rid of many brackets (), but understand the reasons why they are not in yet. C# keeps getting better with each version. Good work.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10147022" width="1" height="1"&gt;</description></item><item><title>re: Why No Extension Properties?</title><link>http://blogs.msdn.com/b/ericlippert/archive/2009/10/05/why-no-extension-properties.aspx#10146411</link><pubDate>Sun, 27 Mar 2011 18:42:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10146411</guid><dc:creator>shawn</dc:creator><description>&lt;p&gt;With the rising popularity of fluent interfaces (including internally at Microsoft) it seems like extension properties would be more and more useful. From setting &amp;quot;properties&amp;quot; like IsRequired() in the new Entity Framework Code First fluent mappings, to being able to namespace ASP.NET MVC HTML Helpers (for example adding Html.Product.SomeProductRelatedHelper() where Product is an extension property on System.Web.Mvc.HtmlHelper), to the canonical Rubyesque 10.Days.Ago example, it seems like it would fill a missing gap in the language. &amp;nbsp;Doing some searches it looks like there is a large demand for this, and I for one would love to see it!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10146411" width="1" height="1"&gt;</description></item><item><title>re: Why No Extension Properties?</title><link>http://blogs.msdn.com/b/ericlippert/archive/2009/10/05/why-no-extension-properties.aspx#10117732</link><pubDate>Wed, 19 Jan 2011 17:35:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10117732</guid><dc:creator>Chris Marisic</dc:creator><description>&lt;p&gt;Eric, We can count on this for 5.0 right?&lt;/p&gt;
&lt;div class="yellowbox"&gt;
&lt;p&gt;I wouldn&amp;#39;t if I were you. - Eric&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10117732" width="1" height="1"&gt;</description></item><item><title>re: Why No Extension Properties?</title><link>http://blogs.msdn.com/b/ericlippert/archive/2009/10/05/why-no-extension-properties.aspx#10004907</link><pubDate>Thu, 29 Apr 2010 23:50:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10004907</guid><dc:creator>mrjimmy</dc:creator><description>&lt;p&gt;What about STATIC extension methods? It's very interesting there's no mention of it here as it's an oft-requested feature that would be extremely usefull.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10004907" width="1" height="1"&gt;</description></item></channel></rss>