// Before:
public struct Distance {
double _dx;
double _dy;
public readonly double Magnitude => Math.Sqrt(_dx * _dx + _dy * _dy);
public readonly double Direction => Math.Atan2(_dy, _dx);
public void Translate(double deltaX, double deltaY) {
_dx += deltaX;
_dy += deltaY;
}
public Distance() : this(0, 0) { }
public Distance(double dx, double dy) {
_dx = dx;
_dy = dy;
}
}
// After:
public struct Distance(double dx, double dy) {
public readonly double Magnitude => Math.Sqrt(dx * dx + dy * dy);
public readonly double Direction => Math.Atan2(dy, dx);
public void Translate(double deltaX, double deltaY) {
dx += deltaX;
dy += deltaY;
}
public Distance() : this(0, 0) { }
}
Code snippet taken from "Complete C# Quick Reference - C# 12".