Multiply it by four, round it as you need to an integer, then divide it by four again:
x = Math.Round (x * 4, MidpointRounding.ToEven) / 4;
The various options for rounding, and their explanations, can be found in this excellent answer here 🙂
More Related Contents:
- How do you round a number to two decimal places in C#?
- Rounding down to 2 decimal places in c#
- How to round decimal value up to nearest 0.05 value?
- Double vs Decimal Rounding in C#
- Math.Round doesn’t behave like i want it to. (X.0xxxxx numbers) [closed]
- How do I display a decimal value to 2 decimal places?
- How to convert numbers between hexadecimal and decimal
- Decimal precision and scale in EF Code First
- How To Represent 0.1 In Floating Point Arithmetic And Decimal
- decimal vs double! – Which one should I use and when? [duplicate]
- How can I round up the time to the nearest X minutes?
- Formatting a float to 2 decimal places
- Round a double to x significant figures
- Why can’t I unbox an int as a decimal?
- Regular expression for decimal number
- Best way to display decimal without trailing zeroes
- Built in .Net algorithm to round value to the nearest 10 interval
- Arbitrary-Precision Decimals in C# [duplicate]
- How to round up value C# to the nearest integer?
- Generating a Random Decimal in C#
- Convert string to decimal, keeping fractions
- String to decimal conversion: dot separation instead of comma
- Efficient way to round double precision numbers to a lower precision given in number of bits
- Conversion of a decimal to double number in C# results in a difference
- use decimal values as attribute params in c#?
- Performing Math operations on decimal datatype in C#?
- Why c# decimals can’t be initialized without the M suffix?
- Round double in two decimal places in C#?
- Why am I getting a compile error when multiplying a decimal by a literal value?
- Raising a decimal to a power of decimal?