using System; namespace VrmLib { public static class ArraySegmentExtensions { public static ArraySegment Slice(this ArraySegment self, int start, int length) { if (start + length > self.Count) { throw new ArgumentOutOfRangeException(); } return new ArraySegment( self.Array, self.Offset + start, length ); } public static ArraySegment Slice(this ArraySegment self, int start) { if (start > self.Count) { throw new ArgumentOutOfRangeException(); } return self.Slice(start, self.Count - start); } } }