在 C# 的字节数组中获取最常用的字节数组?
Get most used byte array in a byte array in c#?
如何从另一个字节数组中获取最常用的字节数组?
有没有简单的方法可以做到这一点?
例如:
输入字节数组:41,4,5,42,4,5,42,4,5,42,2
然后 return: 4, 5, 42
提前致谢。
var grouped = prod.ToLookup(x => x);
var maxRepetitions = grouped.Max(x => x.Count());
var allItemsWithEqualMax = grouped.Where(x => x.Count() == maxRepetitions)
.Select(x => x.Key).ToList();
积分:
如何从另一个字节数组中获取最常用的字节数组? 有没有简单的方法可以做到这一点?
例如:
输入字节数组:41,4,5,42,4,5,42,4,5,42,2
然后 return: 4, 5, 42
提前致谢。
var grouped = prod.ToLookup(x => x);
var maxRepetitions = grouped.Max(x => x.Count());
var allItemsWithEqualMax = grouped.Where(x => x.Count() == maxRepetitions)
.Select(x => x.Key).ToList();
积分: