Rounding values up or down in C#
问题 I've created a game which gives a score at the end of the game, but the problem is that this score is sometimes a number with a lot of digits after the decimal point (like 87.124563563566). How would I go about rounding up or down the value so that I could have something like 87.12? Thanks! 回答1: Try using Math.Round. Its various overloads allow you to specify how many digits you want and also which way you want it to round the number. 回答2: Use Math.Ceiling(87.124563563566) or Math.Floor(87