C# has always supported the ability to pass by reference using the
ref keyword on method parameters. C# 7 adds the ability to return by reference and to store references in local variables.
The primary reason for using ref returns and ref locals is performance. If you have big structs, you can now reference these directly in safe code to avoid copying. Before C# 7 you had …Read More