I want to create custom WeakReference<T>
which would implement an interface passed as generic parameter T
.
Usage:
interface IInterface
{
void SomeMethod(bool param);
}
public class Subject : IInterface { /*...*/ }
var proxyRef = new ProxyWeakReference<IInterface>(new Subject());
proxyRef.SomeMethod(false);
IInterface subject = proxyRef.Target;
Is there any already created solutions to do that? Or what i should use to create such type of proxy?