title: Using extension methods in .NET 2.0?
body: <p>I want to do this, but getting this error:</p>
  
  <blockquote>
    <p>Error 1 Cannot define a new extension method because the compiler
    required type 'System.Runtime.CompilerServices.ExtensionAttribute'
    cannot be found. Are you missing a reference to System.Core.dll?
    [snipped some path stuff]</p>
  </blockquote>
  
  <p>I have seen some answers here that says, you have to define this attribute yourself.</p>
  
  <p>How do I do that?</p>
  
  <p><strong>EDIT</strong>: This is what I have:</p>
  
  <pre><code>[AttributeUsage ( AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method )]
  public sealed class ExtensionAttribute : Attribute
  {
      public static int MeasureDisplayStringWidth ( this Graphics graphics, string text )
      {
  
      }
  }
  </code></pre>