This commit is contained in:
CortexCore
2024-11-08 12:52:09 +08:00
parent 4ba741408d
commit 1650126d55
27 changed files with 851 additions and 193 deletions

View File

@@ -39,5 +39,29 @@ namespace BITKit
{
return self?.GetInvocationList().Cast<Func<T0, T1, T2, T3>>();
}
public static IEnumerable<Func<T0, T1, T2, T3, T4>> CastAsFunc<T0, T1, T2, T3, T4>(
this Func<T0, T1, T2, T3, T4> self)
{
return self?.GetInvocationList().Cast<Func<T0, T1, T2, T3, T4>>();
}
public static IEnumerable<Func<T0, T1, T2, T3, T4, T5>> CastAsFunc<T0, T1, T2, T3, T4, T5>(
this Func<T0, T1, T2, T3, T4, T5> self)
{
return self?.GetInvocationList().Cast<Func<T0, T1, T2, T3, T4, T5>>();
}
public static IEnumerable<Func<T0, T1, T2, T3, T4, T5, T6>> CastAsFunc<T0, T1, T2, T3, T4, T5, T6>(
this Func<T0, T1, T2, T3, T4, T5, T6> self)
{
return self?.GetInvocationList().Cast<Func<T0, T1, T2, T3, T4, T5, T6>>();
}
public static IEnumerable<Func<T0, T1, T2, T3, T4, T5, T6, T7>> CastAsFunc<T0, T1, T2, T3, T4, T5, T6, T7>(
this Func<T0, T1, T2, T3, T4, T5, T6, T7> self)
{
return self?.GetInvocationList().Cast<Func<T0, T1, T2, T3, T4, T5, T6, T7>>();
}
}
}

View File

@@ -167,6 +167,13 @@ namespace BITKit
}
return false;
}
public static IEnumerable<T> RemoveIn<T>(this IEnumerable<T> self, T t)
{
var list = self.ToList();
list.Remove(t);
return list.ToArray();
}
public static bool TryRemove<TKey, TValue>(this IDictionary<TKey, TValue> self, TKey t)
{
if (self.ContainsKey(t))