I want to copy a reference object to a new reference object, and then change values in the second reference object without the first reference object being effected. How can I do it without creating a custom constructor that takes in an object and then copy each value?
example:
class Point
{
public int x { get;set; } = 0;
public int y { get; set; } = 0;
(....)
//main:
Point p1 = new Point(5, 5);
Point p2 = p1;
p2.x = 1;
// I want: p1 is (5,5) and p2 is (1,5)
// actually happends: p1 is (1,5) and p2 is (1,5)