Skip to content

Instantly share code, notes, and snippets.

@Drawaes
Created February 26, 2017 16:56
Show Gist options
  • Save Drawaes/84704a1a8ce8eb9e3bca6ef364d8beb2 to your computer and use it in GitHub Desktop.
Save Drawaes/84704a1a8ce8eb9e3bca6ef364d8beb2 to your computer and use it in GitHub Desktop.
class Program
{
private static readonly TestStruct _Account = new TestStruct();
static void Main(string[] args)
{
Console.WriteLine(_Account.MyMoney);
_Account.UpdateValue(100);
Console.WriteLine(_Account.MyMoney);
Console.WriteLine("Hello World!");
}
public class TestStruct
{
private int _money;
public int MyMoney => _money;
public void UpdateValue(int moneyAmount)
{
_money += moneyAmount;
}
}
}
class Program
{
private static readonly TestStruct _Account = new TestStruct();
static void Main(string[] args)
{
Console.WriteLine(_Account.MyMoney);
_Account.UpdateValue(100);
Console.WriteLine(_Account.MyMoney);
Console.WriteLine("Hello World!");
}
public struct TestStruct
{
private int _money;
public int MyMoney => _money;
public void UpdateValue(int moneyAmount)
{
_money += moneyAmount;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment