[英]Get most used byte array in a byte array in c#?
如何从另一个字节数组中获取最常用的字节数组? 有没有简单的方法可以做到这一点?
例如:
输入字节数组:41, 4, 5, 42,4,5,42,4,5,42,2
然后返回: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();
信用: https ://stackoverflow.com/a/15184669/496680
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.