Tech Off Post

Single Post Permalink

View Thread: Generi type inheritance ????
  • User profile image

    Anyone at Microsoft ever considered to include generic type inheritance in the next release?

    What I mean is someting like this :

     class MyClass<T> : T {

    where the inheritance chain is chosen when the type is constructed.

    I personaly forsee this to be very useful and i'll give a small example : 

    Let's say an ipothethical scenario where I want to give an arbitrary class the ability to store state and snapshot info. Ofcourse I could do this by simply subclasing it or create a generic class to be a container ofering those capablities, but :

             - in the first case the same implemetation must be done for every new type (Copy code)

             - in the second case the ineritance chain is lost so the container type can't be used in place o the actual type.

    Other useful usages caul be somethin like DataTable<Person> or DataTable<Company> where the DataTable<> type ads an ItemArray property, and RowVersionPropery etc. an actualy makes extens the class so it can be added to an datatable ...

    Anyone else had those kind of ideeas before?