What is Span data structure that announced in C# 7.2? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is Span data structure that announced in C# 7.2?

I'd seen Span<T> data structure that announced in DotNet Conf 2018 for C# language, it seems very look like to array or List data structures. Can anyone describe what is exactly Span and what is differences between with other collections?

20th Sep 2018, 9:22 PM
Saeid Doroudi
Saeid Doroudi - avatar
1 Answer
+ 3
I have found a very helpful article in Adam Sitnik's blog: https://adamsitnik.com/Span/ Span<T> (previously called Slice) is a simple value type that allows us to work with any kind of contiguous memory: Unmanaged memory buffers Arrays and subarrays Strings and substrings It ensures memory and type safety and has almost no overhead.
21st Sep 2018, 4:00 AM
Saeid Doroudi
Saeid Doroudi - avatar