title: How to use method parameter attributes
body: <p>I've been struggling to find examples of how to write a custom attribute to validate method parameters, i.e., turn this form:</p>
  
  <pre><code>public void DoSomething(Client client)
  {
      if (client.HasAction("do_something"))
      {
          // ...
      }
      else
      {
          throw new RequiredActionException(client, "do_something");
      }
  }
  </code></pre>
  
  <p>into this:</p>
  
  <pre><code>public void DoSomething([RequiredAction(Action="some_action")] Client client)
  {
      // ...
  }
  </code></pre>
  
  <p>As far as I can tell, I need to add this attribute to my custom attribute, but I'm at a loss on how to access the decorated parameter <code>Client</code>:</p>
  
  <pre><code>[AttributeUsageAttribute(AttributeTargets.Parameter)]
  public class RequireActionAttribute : System.Attribute
  {
      public Type Action {get; set;}
  
      public RequireActionAttribute()
      {
          // .. How do you access the decorated parameter?
          Client client = ???
  
          if (!client.HasAction(Action))
          {
              throw new RequiredActionException(client, Action);
          }
      }
  }
  </code></pre>