title: IQueryable<T> Extension Method not working
body: <p>How can i make an extension method that will work like this</p>
  
  <pre><code>public static class Extensions&lt;T&gt;
  {
      public static IQueryable&lt;T&gt; Sort(this IQueryable&lt;T&gt; query, string sortField, SortDirection direction)
      {
          // System.Type dataSourceType = query.GetType();
  
          //System.Type dataItemType = typeof(object);
  
          //if (dataSourceType.HasElementType)
          //{
          //    dataItemType = dataSourceType.GetElementType();
          //}
          //else if (dataSourceType.IsGenericType)
          //{
          //    dataItemType = dataSourceType.GetGenericArguments()[0];
          //}
  
          //var fieldType = dataItemType.GetProperty(sortField);
          if (direction == SortDirection.Ascending)
              return query.OrderBy(s =&gt; s.GetType().GetProperty(sortField));
          return query.OrderByDescending(s =&gt; s.GetType().GetProperty(sortField));
  
      }
  }
  </code></pre>
  
  <p>Currently that says "Extension methods must be defined in a non-generic static class".</p>
  
  <p>How do i do this?</p>