1

I want to be able to do this.

MyInterface interface = new ServiceProxyHelper<ProxyType>();

Here's the object structure

MyTypeThatImplementsMyInterface : MyInterface

Will this work?

public class ProxyType : MyInterface {}

public class ServiceProxyHelper<ProxyType> : IDisposable, MyInterface {}
user17222
  • 1,691
  • 3
  • 15
  • 17
  • Related question:
    [Create Generic method constraining T to an Enum](http://stackoverflow.com/questions/79126/create-generic-method-constraining-t-to-an-enum#79142)
    – Nescio Sep 18 '08 at 05:13

1 Answers1

3

I think this is what you're trying to do:

public class ServiceProxyHelper<T> where T : MyInterface { ... }
jfs
  • 16,758
  • 13
  • 62
  • 88