
C#
var arr = new byte[10];var slice = new Span(arr, 5, 2);
Go:var arr [10]intvar slice = arr[5:7]"In both languages, a span(C#) or a slice (Go) represent a similar concept:
- C#: ‘Span is a value type containing a ref and a length‘ , ‘represent contiguous regions of arbitrary memory‘
- Go: ‘Slice is a descriptor for a contiguous segment of an underlying array and provides access to a numbered sequence of elements from that array‘"
No comments:
Post a Comment