This project is read-only.

Rename properties of a derived class


For user framework it would be great for generic classes to override some properties with a concrete name, so it is easier to understand what some properties means and to reduce the manual coding.

The syntax can look like:
public class ConcreteClass : Tuple<bool>
    public bool IsClosed {get;set;} : Item1
If using ConcreteClass you only see IsClosed as property. Only if the class is used as Tuple<bool> you will see Item1 property.


forki wrote Apr 4, 2014 at 9:12 PM

I assume this would pretty much break everything we know about inheritance.

IceyPoi wrote Apr 5, 2014 at 9:08 AM

Something like that could work, if it was not a syntax for inheritance but for composition. Otherwise you break Liskov Substitution Principle already during compilation time.

tom103 wrote Apr 21, 2014 at 9:53 PM

I'm not sure I see the point of this. If you go to the trouble of implementing a specific class for your needs, what's the point in using Tuple at all ?

MgSam wrote Apr 24, 2014 at 3:14 PM

I think the idea here is to introduce an alias for the property, right? While I could see this making sense for Tuple, my guess is it might raise a whole host of hairy issues.

@tom103 I think the point being you could have a method which takes a parameter of Tuple and then pass this type in and still have it work, without sacrificing readability.