|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|