The class is now able to take part in the wonderful world of LINQ so we can do the usual LINQ things like query the contents, reverse the contents without affecting the original array, get the first item, and so on:var array = new byte[] { 5, 8, 9, 20, 70, 44, 2, 4 };array.Dump();var segment = new ArraySegment<byte>(array, 2, 3);segment.Dump(); // output: 9, 20, 70segment.Reverse().Dump(); // output 70, 20, 9segment.Any(s => s == 99).Dump(); // output falsesegment.First().Dump(); // output 9array.Dump(); // no change 这篇关于ArraySegment<T>有什么用?班级?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-11 03:11