What is Span in C# and why you should be using it
247,007
Published 2021-07-13
Check out my courses: dometrain.com/
Hello everybody I'm Nick and in this video I am going to talk about Span of T in C#. Span was introduced in C# and .NET alongside a series of optimisations all the way back in .NET 2.1 and it has come to my attention that it is really confusing to understand if you just read the documentation for it. In this video I will break it down for you and help you understand exactly what it is, how it works and how you can use it in your applications today!
Don't forget to comment, like and subscribe :)
Social Media:
Follow me on GitHub: bit.ly/ChapsasGitHub
Follow me on Twitter: bit.ly/ChapsasTwitter
Connect on LinkedIn: bit.ly/ChapsasLinkedIn
Keep coding merch: keepcoding.shop/
#csharp #dotnet #span
All Comments (21)
-
Hello everybody. As some people have already pointed out, after 13:50, when I'm returning a ReadOnlySpan, the ToString() on line 21 should be removed. I didn't notice because of the implicit operator. If you leave the ToString() in then you still allocate the string you return. - Keep coding
-
I'm a systems developer and primarily work with low-level languages like ASM, C, C++, etc., so I don't have a lot of experience on the intricate details of optimizations for managed languages. Explanations like these are invaluable and I find them immeasurably useful so I thank you very much for this.
-
Span is a really under-rated feature, not just for performance, but also my favourite pun in C# - TimeSpan
-
I'm so impressed by these explanations. Honestly, the best thing to happen for a junior dev, is to find your channel. Great explanations, very helpful videos with in-depth knowledge and analysis. Thank you, please keep doing them!!
-
When I first watched Microsoft themselves explain Span, I was lost and confused. They have a knack for making something sound way more convoluted and complex than needed when they explain new concepts. This video made it all click instantly. Thank you very much, I can't wait to start using Span in my own work.
-
I love these types of videos that explain the standard classes in the framework that help you write more efficent code. These are the types of things I don't stumble upon when researching how to solve a problem. I would love to see more videos like these!
-
Great explanation, Nick, yet again! Thank you for taking the time, in your very informative videos, to show us what's happening "behind the scenes". On the heap, stack, etc. 🙏🏻
-
Thank you for this video. As Unity 2021 LTS now supports spans this gave a really good introduction and explanation on how to use them. Also the ref struct is valuable information since I have some very short lived structs for triangles and other mesh-related objects that only live for the duration of the method.
-
Great video. This is a topic I've been half-aware of for a while, but seeing it in context helps a lot.
-
Didn't learn anything new in this, but I'm impressed by your presentation. I would have more quickly learned how Span works if this was the first video I saw about it.
-
hey Nick, I have been watching your videos for a while. Just want to thank you so much for the learnings I got from them. You cannot imagine how helpful you are to people like me. I am using these learnings in a software solution I am developing myself already for a year. Again, thanks!!! Andre from Portugal
-
Your video's are awesome. I very much appreciate the technical in-depth explanations of them. Thanks a ton!
-
As usual, you explain the nuts and bolts, the theory, and the benefits, all better than the documentation and anything else I’ve found.
-
Had missed the memo on this one. Thanks, this was really informative!
-
Nothing new under the sun but very well explained. It's useful to have this kind of videos around, proper knowledge should be distributed like this.
-
this is the first explanation of Span that made sense to me. thank you!!
-
To me, these are the best technical videos on the net, even though about 95 percent of them are over my head. This video, however, was worthy of getting a bowl of popcorn, sitting back and just watching. Thanks a bunch, Nick.
-
I really appreciate your content Nick, helped me a lot improve the way i code :)
-
Very nice explanation. Will surely be helpful in my work. Thanks!
-
Amazing delivery. Thank you!