With this class definition:
public class Wrapper<T>
{
public T Item;
public Wrapper(T item)
{
Item = item;
}
public static implicit operator T(Wrapper<T> wrapper)
{
return wrapper.Item;
}
public static implicit operator Wrapper<T>(T item)
{
return new Wrapper<T>(item);
}
}
I am wondering if there is a way to invoke a method as the Item as the Wrapper object, without doing the obvious Wrapper.Item.Bar();
So rather than do this:
Wrapper<Foo> wrappedFoo = new Foo();
wrappedFoo.Item.Bar();
I want to do this:
Wrapper<Foo> wrappedFoo = new Foo();
wrappedFoo.Bar(); //equivalent to wrappedFoo.Item.Bar();
Thanks for your help.