Possible duplicate:
Sort IList in C #
I have the following method, and I need to sort the iList object that is passed to it (inside this method). I tried linq, but since it is an interface, I get errors.
Thank you in advance
private void AddListToTree(ComponentArt.Web.UI.TreeView treeView, IList list) {
Please note that my type is dynamic.
I think I need to create a temporary collection, fill it out, if from my IList instance, sort it, get the corresponding instance of an object that supports IList, and use it instead of my unsorted IList instance, which I should leave unchanged. So I tried to get the following type:
Type[] listTypes = list.GetType().GetGenericArguments(); Type listType = null; if (listTypes.Length > 0) { listType = listTypes[0]; }
But I can not create a new List with this type
source share