The overriding method cannot change the inherited constraints.

image_pdfimage_print
   
 

using System;

public class MyClass {
    public virtual void MethodA<T>(T arg)
        where T : new() {
    }
}

public class YClass : MyClass {
    public override void MethodA<T>(T arg) {
        T obj = new T();
    }
}

    


This entry was posted in Generics. Bookmark the permalink.