This project is read-only.

Extension Properties

Topics: C# Language Design
Apr 30, 2014 at 4:07 PM
Edited Apr 30, 2014 at 4:10 PM
As mentioned in this article (point 3): http://www.gamasutra.com/blogs/PedroGuida/20140113/208518/Regarding_the_future_of_C_.php

So far, we can only implement getters (and setters) like this:
   public static string NameToDisplayGetter (this IPerson person)
   {
      ...
   }
The proposal is a syntax similar to the following:
   public static string NameToDisplay: IPerson person
   {
      get { ... } // You could also add a setter, if needed.
   }
or
   public static string NameToDisplay: this IPerson person
   {
      get { ... } // You could also add a setter, if needed.
   }
May 1, 2014 at 10:05 PM
Edited May 1, 2014 at 10:16 PM
How about this (following your example):
public static string StaticPropertyName(this IPerson)
   { get { ... } }
May 2, 2014 at 6:15 PM
Didn't see this thread which also proposes the same with a different approach: https://roslyn.codeplex.com/discussions/541454