4 ms·
The author fails to mention the only truly-abusive us of this: working around readonly variables: struct Location { public readonly float x; public r
by mwkaufma 6y ago
The author fails to mention the only truly-abusive us of this: working around readonly variables:
struct Location {
public readonly float x;
public readonly float y;
public Location(float ax, float ay) {
x = ax;
y = ay;
}
public float X {
get { return x; }
set { this = new Location(value, y); }
}
}
- Someone1234 6y agoThat's evil. I'm both impressed and horrified by that trick. I had to try it because I at least thought I might get a compiler/IntelliSense warning, but nope, it works perfectly and silently.
- jermaustin1 6y agoI did not mention this because I had no idea this was even possible. Whoever found this out is an psychopath ;).