title: ASP.NET: Built-in Gridview Sorting of Generic.List(Of T)
body: <p>The question is whether built-in sorting of a Generic.List(Of T) is possible. We have a custom gridview that is compiled into its own DLL along with a compiled DLL of classes. Right now, I'm able to get the count by casting a Generic.List to iCollection for paging purposes, but can I create some sort of Sort function that will accept any Generic.List(Of AnyType) and sort accordingly.</p>
  
  <p>I've been able to cast a Generic.List(Of AnyType) to a Generic.List(Of Object), and I think I can cast the objects within that collection to the same type and sort, but I'm not sure if that's possible. My concern now is that I won't be able to cast the objects back to their original type due to the classes being in a compiled state.</p>
  
  <p>Is this a safe assumption, or is it possible to do this? Is it more favorable to simply skip the control sorting for Generic Lists and simply allow the developer to do the sorting in the event via LINQ or other means.</p>