Point b = a; Point c = a; ... } struct Point { public int x, y; public Point(int x, int y) { this.x = x; this.y = y; } ... } Stack Heap a = Point(2,4) b = Point(2,4) c = Point(2,4)
Point b = a; Point c = a; ... } class Point { public int x, y; public Point(int x, int y) { this.x = x; this.y = y; } } Stack Heap a(ref) b(ref) c(ref) a Point(2,4)
private Point(int _x, int _y) { this.x = _x; this.y = _y; } public static Point of(int _x, int _y) { return new Point(_x,_y); } } public inline class Point { private int x; private int y; private Point(int _x, int _y) { this.x = _x; this.y = _y; } public static Point of(int _x, int _y) { return new Point(_x,_y); } }