Billing: Add feature to calculate member/delivery bins
This commit is contained in:
@ -326,5 +326,19 @@ namespace Elwig.Helpers {
|
||||
return (familyName, fullName.Replace(familyName, "").Replace(" ", " ").Trim());
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<IEnumerable<T>> Permutate<T>(IEnumerable<T> input) {
|
||||
List<IEnumerable<T>> output = new();
|
||||
for (int i = 0; i < Math.Pow(2, input.Count()); i++) {
|
||||
List<T> t = new();
|
||||
for (int j = 0; j < 30; j++) {
|
||||
if ((i & (1 << j)) != 0) {
|
||||
t.Add(input.ElementAt(j));
|
||||
}
|
||||
}
|
||||
output.Add(t);
|
||||
}
|
||||
return output.OrderByDescending(l => l.Count());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user