I am having trouble conceptualizing the usages for the new Span in C#.
What construct(s) does it replace? Is ArraySegment now obsolete?
What fu
From MSDN Magazine: Span is defined in such a way that operations can be as efficient as on arrays: indexing into a span doesn’t require computation to determine the beginning from a pointer and its starting offset, as the ref field itself already encapsulates both. (By contrast, ArraySegment has a separate offset field, making it more expensive both to index into and to pass around.)
Also, while ArraySegment implements IEnumerable
, Span doesn't.