Actualy it doesn't break any encapsulation it's just inheritance
if inheritance breaks encapsulation this does too.
If it is done by the rules of inheritance it does't break encapsulation . It can't. How?
And btw MyClass<String> it should't be ilegal because String is a sealed class.
so If
class MyClass : string { // not legal 'String' is sealed class
}
VS Error :
"Error 1 'Testing.MyClass': cannot derive from sealed type '"
so should be :
MyClass<String> instance;
I don't see any where your objections are coming from.
I dind't try to sugest a way to break encapsulation but a way to construct a generic type that subclases another type at use time.
And I'm not sugesting any new features or anithing that can't be done with curent language and platform features