Subscribe delegates to all methods of a class
<p>I have just familiarized myself a little bit with C# delegates. One can subscribe multiple delegate instances to a delegate by the "+=" operator. But is it also possible to have a controller class that has delegates for all the methods in second class, and have the methods being added automatically, i.e. without having to add (or even know) each method individually to the corrsponding delegate ?</p>

<p>In simplified code (omitting access modifiers etc.):</p>

<pre><code>class Car
{
    void Start();
    void Drive();
}

// I would like to have the following class generated automatically
// without needing to repeat all the methods of Car, i.e.
// without declaring a delegate instance for each of them
class CarController
{
    delegate void DoSomething();

    DoSomething StartAll;
    DoSomething DriveAll;

    void Subscribe(Car anotherCar)
    {
        StartAll += anotherCar.Start;
        DriveAll += anotherCar.Drive;
    }
}
</code></pre>

<p>EDIT:
Rawling's solution is the one that I like best. It's simple and clear. As a little tweak I have tried how the thing would work with dynamically typed objects, and it works indeed: complete decoupling between Controller and controlled objects. Of course such usage of "dynamic" is not of everyone's taste...</p>

<pre><code>public class CallAller2 : HashSet&lt;dynamic&gt;
{
    public void CallAll(Action&lt;dynamic&gt; action)
    {
        foreach (dynamic t in this)
        {
            try {action(t);} catch (RuntimeBinderException) {};
        }
    }
}

class Bike
{
    void Drive();
}

CallAller2 ca = new CallAller2();
ca.Add(new Car());
ca.Add(new Bike());
ca.CallAll(c =&gt; c.Start());  // is ignored by Bike which does not implement it  
ca.CallAll(c =&gt; c.Drive());
</code></pre>
