title: Attributes on an interface
body: <p>I have a interface that defines some methods with attributes.  These attributes need to be accessed from the calling method, but the method I have does not pull the attributes from the interface.  What am I missing?</p>
  
  <pre><code>public class SomeClass: ISomeInterface
  {
      MyAttribute GetAttribute()
      {
          StackTrace stackTrace = new StackTrace();
          StackFrame stackFrame = stackTrace.GetFrame(1);
          MethodBase methodBase = stackFrame.GetMethod();
          object[] attributes = methodBase.GetCustomAttributes(typeof(MyAttribute), true);
          if (attributes.Count() == 0)
              throw new Exception("could not find MyAttribute defined for " + methodBase.Name);
          return attributes[0] as MyAttribute;
      }
  
      void DoSomething()
      {
          MyAttribute ma = GetAttribute();
          string s = ma.SomeProperty;
      }
  }
  </code></pre>