title: C# - Generic Action?
body: <p>I'm using .NET Framework 4.0. Looking the documentation for Action (<a href="http://msdn.microsoft.com/en-us/library/018hxwa8(v=vs.100).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/018hxwa8(v=vs.100).aspx</a>), they give this example comparing delegate to Action:</p>
  
  <pre><code>delegate void DisplayMessage(string message);
  
  public class TestCustomDelegate
  {
      public static void Main()
      {
          DisplayMessage messageTarget;
          ...
      }
  }
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>public class TestAction1
  {
      public static void Main()
      {
          Action&lt;string&gt; messageTarget;
          ...
      }
  }
  </code></pre>
  
  <p>But, how do I create this using an Action instead of a delegate?</p>
  
  <pre><code>delegate void DisplayMessage&lt;T&gt;(T message);
  
  public class TestCustomDelegate
  {
      public static void Main()
      {
          DisplayMessage&lt;string&gt; messageTarget;
          ...
      }
  }
  </code></pre>
  
  <p>Edit: I forgot the type definition in my messageTarget declaration. Added it now.</p>