Created
May 5, 2018 22:00
Star
You must be signed in to star a gist
ref returns, ref locals, ref readonly, and ref struct with C# 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ref returns and ref locals with C# 7.0 | |
int[] _numbers = { 3, 7, 11, 15, 21 }; | |
public ref int GetNumber(int index) | |
{ | |
return ref _numbers[index]; | |
} | |
// ref readonly with C# 7.2 | |
int[] _numbers = { 3, 7, 11, 15, 21 }; | |
public ref readonly int GetNumber(int index) | |
{ | |
return ref _numbers[index]; | |
} | |
// ref struct with C# 7.2 | |
ref struct OnlyOnTheStack | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment