forked from amkovkov/GranuSightSoftware2
feat: Dictionary AddRange extensions
This commit is contained in:
@@ -15,7 +15,7 @@ public static class EnumerableExtensions
|
|||||||
strs.Add($"{enumerator.Key}: {enumerator.Value}");
|
strs.Add($"{enumerator.Key}: {enumerator.Value}");
|
||||||
return string.Join(separator, strs.Select(s => $"{new string(' ', indent)}{s}"));
|
return string.Join(separator, strs.Select(s => $"{new string(' ', indent)}{s}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ToString<TValue>(this IEnumerable<TValue> values, string separator, int indent) => (values as IEnumerable).ToString(separator, indent);
|
public static string ToString<TValue>(this IEnumerable<TValue> values, string separator, int indent) => (values as IEnumerable).ToString(separator, indent);
|
||||||
public static string ToString(this IEnumerable values, string separator, int indent)
|
public static string ToString(this IEnumerable values, string separator, int indent)
|
||||||
{
|
{
|
||||||
@@ -28,5 +28,11 @@ public static class EnumerableExtensions
|
|||||||
|
|
||||||
public static bool All(this IEnumerable<bool> values) => values.All(v => v);
|
public static bool All(this IEnumerable<bool> values) => values.All(v => v);
|
||||||
public static bool Any(this IEnumerable<bool> values) => values.Any(v => v);
|
public static bool Any(this IEnumerable<bool> values) => values.Any(v => v);
|
||||||
|
|
||||||
|
public static void AddRange<TValue, TKey>(this IDictionary<TValue, TKey> values, IEnumerable<KeyValuePair<TValue, TKey>> collection)
|
||||||
|
{
|
||||||
|
foreach (var kv in collection)
|
||||||
|
values.Add(kv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user