Created
January 8, 2018 02:16
-
-
Save mindingdata/f1cc1c32c99ec1068ef51071c97d21c3 to your computer and use it in GitHub Desktop.
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
struct MyStruct | |
{ | |
public int MyValue { get; set; } | |
public void UpdateMyValue(int value) | |
{ | |
MyValue = value; | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
MyStruct myStruct = new MyStruct(); | |
myStruct.UpdateMyValue(1); | |
UpdateMyValue(myStruct); | |
Console.WriteLine(myStruct.MyValue); | |
Console.ReadLine(); | |
} | |
static void UpdateMyValue(in MyStruct myStruct) | |
{ | |
myStruct.UpdateMyValue(5); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from : https://dotnetcoretutorials.com/2018/01/08/new-keyword-c-7-2/