Somehow I missed such a useful class in .Net framework this now. This class is useful when we are working on one dimensional arrays and need to segment arrays.
One quick use case is network packets. Where we will allocate buffer upfront and fill segments to form a packet.
Good part of this class is multiple arraysegment objects can refer to same instance of array. Mean what we get is reference to original object rather than a copy. Any updates to segment will automatically update original array.
Isn’t useful? I feel so.