كيف يمكنني استخدام .صافي الوراثة وراثة قالب المعلمة ؟
سؤال
أريد أن تكون قادرة على القيام بذلك.
MyInterface interface = new ServiceProxyHelper<ProxyType>();
هنا بنية الكائن
MyTypeThatImplementsMyInterface : MyInterface
هل هذا العمل ؟
public class ProxyType : MyInterface {}
public class ServiceProxyHelper<ProxyType> : IDisposable, MyInterface {}
المحلول
وأعتقد أن هذا هو ما كنت تحاول القيام به:
public class ServiceProxyHelper<T> where T : MyInterface { ... }
لا تنتمي إلى StackOverflow