Session

The ins and outs of ref in C#

Over the past two decades, passing arguments by reference has come a long way in C#. With modern versions of the language, we not only have "ref" and "out" at our disposal, but also "in", "scoped ref" and "ref readonly". But wait, there's more! ByRef returns, local by-reference variables, and ref structs with ref fields, including the upcoming generic anti-constraint for ByRef-like types.

All these variations of references are used more and more in the Base Class Library and NuGet packages from the .NET ecosystem, for example, by the mighty type "Span" and its related memory APIs. It's high time to learn the differences and applications of all of these keywords to unlock correctness and high-performance for our .NET apps and libraries.

Stefan Pölz

Clean C# Coder – Test-driven .NET Developer

Vienna, Austria

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top