Use switch expressions

This commit is contained in:
Jason Nelson
2024-03-15 10:50:20 -07:00
committed by BobLd
parent dca11253a0
commit 9859c2672b
7 changed files with 67 additions and 130 deletions

View File

@@ -25,19 +25,13 @@
{
get
{
switch (Value)
{
case 0:
return 0;
case 90:
return -0.5 * Math.PI;
case 180:
return -Math.PI;
case 270:
return -1.5 * Math.PI;
default:
throw new InvalidOperationException($"Invalid value for rotation: {Value}.");
}
return Value switch {
0 => 0,
90 => -0.5 * Math.PI,
180 => -Math.PI,
270 => -1.5 * Math.PI,
_ => throw new InvalidOperationException($"Invalid value for rotation: {Value}.")
};
}
}