Created
February 19, 2013 17:53
-
-
Save abbas-oveissi/4988183 to your computer and use it in GitHub Desktop.
sample C# code for Value vs Reference Types
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 Point | |
{ | |
private int x, y; // private fields | |
public Point (int x, int y) // constructor | |
{ | |
this.x = x; | |
this.y = y; | |
} | |
public int X // property | |
{ | |
get {return x;} | |
set {x = value;} | |
} | |
public int Y | |
{ | |
get {return y;} | |
set {y = value;} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment