by lern_too_spel · 10y ago · 0 comments
If a method needs to instantiate an object, the normal technique is to accept a factory function as a parameter. You can do the same thing with type-erased generics.
C# decided to create a shortcut for calling the constructor of a generic type parameter. But, for example, you can't call static methods of a generic type parameter (and a constructor is really just a slightly special static method).
I'm not sure how this makes sense. These tags are just standard context bounds, which are extremely useful and quite awesome.
You make it sound as if these tags were some kind of special feature added to the language, or context bounds were solely invented to support these tags.