Skip to content

Instantly share code, notes, and snippets.

@mindingdata
Created January 8, 2018 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindingdata/f1cc1c32c99ec1068ef51071c97d21c3 to your computer and use it in GitHub Desktop.
Save mindingdata/f1cc1c32c99ec1068ef51071c97d21c3 to your computer and use it in GitHub Desktop.
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);
}
}
@mindingdata
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment