Is it possible to compose two interfaces and duck type a class to the composition?
<p>I have a class that inherits from <code>ObservableCollection&lt;T&gt;</code> to re-use the <code>INotifyCollection</code> functionality, but acts like a <code>HashSet</code>. I've called it <code>ObservableHashSet&lt;T&gt;</code>. I use both <code>ObservableCollection</code> and <code>ObservableHashSet</code> in my app.</p>

<p>I've reached a point where I want to pass either an <code>ObservableCollection</code> or an <code>ObservableHashSet</code> into a method, but the only functionality I'm interested in is <code>IEnumerable&lt;T&gt;</code> and <code>INotifyCollectionChanged</code>.</p>

<p>My question is: is it possible to have a single method that takes as its parameter either of these classes? i.e.</p>

<pre><code>ObservableCollection&lt;IExample&gt; a = new ...
ObservableHashSet&lt;IExample&gt; b = new ...
MyMethod(a);
MyMethod(b);
</code></pre>

<p>I'm using .NET 4, in case there are any juicy features in there that are useful...</p>
