title: Is there a C# equivalent to Ruby's `respond_to?`?
body: <p>I'm writing a simple wrapper to "duck" a <code>dynamic</code> object against a known interface:</p>
  
  <pre><code>interface IFoo { string Bar(int fred); }
  
  class DuckFoo : IFoo
  {
      private readonly dynamic duck;
  
      public DuckFoo(dynamic duck)
      {
          this.duck = duck;
      }
  
      public string Bar(int fred)
      {
          return duck.Bar(fred);
      }
  }
  </code></pre>
  
  <p>This works fine if the <code>dynamic</code> object can respond to the <code>Bar</code> signature. But if it cannot this fails only when I call <code>Bar</code>. I would prefer if it could fail faster, i.e., with argument validation upon construction of the <code>DuckFoo</code> wrapper. Something like this:</p>
  
  <pre><code>public DuckFoo(dynamic duck)
  {
      if(/* duck has no matching Bar method */)
          throw new ArgumentException("duck", "Bad dynamic object");
      this.duck = duck;
  }
  </code></pre>
  
  <p>In Ruby there is a <code>respond_to?</code> method that can be used to test if an object "has" a certain method. Is there a way to test that with dynamic objects in C# 4?</p>
  
  <p>(I am aware that even with this check the Bar call could fail later on because the dynamic nature of the <code>duck</code> lets it stop responding to methods later on.)</p>