Browse Source

Fix build of BAML decompiler.

pull/1030/head
Siegfried Pammer 7 years ago
parent
commit
5faead453c
  1. 2
      ICSharpCode.Decompiler/Util/CollectionExtensions.cs
  2. 14
      ILSpy/ExtensionMethods.cs

2
ICSharpCode.Decompiler/Util/CollectionExtensions.cs

@ -4,7 +4,7 @@ using System.Linq; @@ -4,7 +4,7 @@ using System.Linq;
namespace ICSharpCode.Decompiler.Util
{
public static class CollectionExtensions
static class CollectionExtensions
{
public static void Deconstruct<K, V>(this KeyValuePair<K, V> pair, out K key, out V value)
{

14
ILSpy/ExtensionMethods.cs

@ -159,5 +159,19 @@ namespace ICSharpCode.ILSpy @@ -159,5 +159,19 @@ namespace ICSharpCode.ILSpy
return s;
return s.Substring(0, length) + "...";
}
/// <summary>
/// Equivalent to <code>collection.Select(func).ToArray()</code>, but more efficient as it makes
/// use of the input collection's known size.
/// </summary>
public static U[] SelectArray<T, U>(this ICollection<T> collection, Func<T, U> func)
{
U[] result = new U[collection.Count];
int index = 0;
foreach (var element in collection) {
result[index++] = func(element);
}
return result;
}
}
}

Loading…
Cancel
Save