title: How to create a generic extension method?
body: <p>I want to develop a Generic Extension Method which should arrange the string in alphabetical then by lengthwise ascending order.</p>
  <p>I mean</p>
  <pre><code>string[] names = { &quot;Jon&quot;, &quot;Marc&quot;, &quot;Joel&quot;,
                    &quot;Thomas&quot;, &quot;Copsey&quot;,&quot;Konrad&quot;,&quot;Andrew&quot;,&quot;Brian&quot;,&quot;Bill&quot;};
  
  var query = names.OrderBy(a =&gt; a.Length).ThenBy(a =&gt; a);
  </code></pre>
  <p>What is the way to develop Generic Extension Method?</p>
  <p>I tried :</p>
  <pre><code>public static class ExtensionOperation
      {
          public static T[] AlphaLengthWise&lt;T&gt;(this T[] names)
          {
              var query = names.OrderBy(a =&gt; a.Length).ThenBy(a =&gt; a);
              return query;
          }
      }
  </code></pre>
  <p>I received :</p>
  <blockquote>
  <p>Error 1: T does not contain definition for Length</p>
  <p>Error 2: can not convert <code>System.Linq.IOrderedEnumerable</code> to <code>T[]</code>.</p>
  </blockquote>