Ref locals and returns

C# language has always had the ref keyword, which allows you to use and return reference to variables defined elsewhere. C# 7 adds another feature, ref locals and returns, which improves performance and allows you to declare helper methods that were not possible with the earlier versions of the language. The ref locals and returns keyword have some restrictions—you cannot use them with the async methods and you cannot return a reference to a variable with the same execution scope.

Get C# and .NET Core Test Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.