Browse Source

AssemblyList: add Sort() method

pull/144/head
Daniel Grunwald 14 years ago
parent
commit
e5f043e643
  1. 18
      ILSpy/AssemblyList.cs

18
ILSpy/AssemblyList.cs

@ -17,7 +17,9 @@ @@ -17,7 +17,9 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.IO;
@ -143,5 +145,21 @@ namespace ICSharpCode.ILSpy @@ -143,5 +145,21 @@ namespace ICSharpCode.ILSpy
assemblies.Remove(assembly);
}
}
public void Sort(IComparer<LoadedAssembly> comparer)
{
Sort(0, int.MaxValue, comparer);
}
public void Sort(int index, int count, IComparer<LoadedAssembly> comparer)
{
App.Current.Dispatcher.VerifyAccess();
lock (assemblies) {
List<LoadedAssembly> list = new List<LoadedAssembly>(assemblies);
list.Sort(index, Math.Min(count, list.Count - index), comparer);
assemblies.Clear();
assemblies.AddRange(list);
}
}
}
}

Loading…
Cancel
Save