I'm looking for an answer to the following:
Round the mathematical constant pi to 2 or 4 decimals.
I have tried the following:
Double piRounded;
piRounded = Math.Round.PI(4);
piRounded = Math.Round.PI(2);
This results in the following error:
'System.Math.Round(double)' is a 'method', which is not valid in the given context
Math.Round in your code is being specified as a property, not a method invocation.
Place your parameters in the round function like Math.Round(...)
- You will want to pass in the PI constant.
Math.Round(Math.PI, 4)
(as stated in comments).