title: C# Custom attributes passed down to called methods
body: <p>Is there a way to get custom attributes which are added along the flow? I'm adding custom attributes to different methods in different classes that are called depending on the flow. I've tried MethodBase.GetCurrentMethod() but this (as it says) only the current invoked method. Using new StackFrame(n) also doesn't work since &quot;n&quot; can frequently change. Googled my problem but didn't find any hints.</p>
  <pre><code>public class CustomAttribute1 : Attribute 
  {
      public bool Property { get; }
  
      public CustomAttribute1(bool property) =&gt; Property = property;
  }
  
  public class CustomAttribute2 : Attribute
  {
      public string Property { get; }
  
      public CustomAttribute2(string property) =&gt; Property = property;
  }
  
  
  public class GeneralService 
  {
      protected void Resolve() 
      {
          // Here I want to access custom attributes combined 
      }
  }
  
  public class SpecifiedService : GeneralService
  {
      [CustomAttribute1(true)]
      public void SendRequest() 
      {
          Resolve();
      }
  }
  
  public class Worker
  {
      [CustomAttribute2(&quot;init&quot;)]
      public void Init()
      {
          var service = new SpecifiedService();
          service.SendRequest();
      }
  }
  </code></pre>