There is a quirk with Math.Round. It defaults to rounding to the nearest even number, so 1.5 = 2, 2.5 = 2. If you use Math.Round(2.5, MidpointRounding.AwayFromZero) it will round to the nearest whole number.

with the 0 being the number of decimal places you would like to round to

Have you checked this? None of the overloads for .Parse accept the input types you have shown. It accepts a string and optionally an IFormatProvider and/or a NumberStyle.

Also, people keep pointing to Math.Round() but if you read the article ddanbe linked to you will see that there are several commonly used 'tie breaker' situations when rounding .5 values. The default in visual studio is to Round to the Nearest Even number. This is the tiebreaker used in bookkeeping and gives the most accurate summing of values.

It isn't, however, the method most people use. You can specify overload the Math.Round method to specify the MidpointRounding method to use. That way you can be sure of the results your rounding will yield.

Dont mean to go on, but it can trip you up if you dont know its there ;)

A person starts out as the "Curator" and stands at the end of a field. Everyone else playing stands at the far end (distance depends upon playing area selected). The ...

I am currently working on a program to track my mile for my monthly expense report for work. Everything is working great, however, I can not for the life of ...

I am trying to understand the SynchronizedMap and I ran the below code. I get the below Output with an exception. According to my understanding the exception is caused when ...