Your code will work as expected. C# decimal
s are optimized to be very accurate at representing base 10 numbers, so if that’s what you’re comparing (money, …), everything should be fine.
Here’s a very clear explanation about the accuracy of decimals by Jon Skeet:
Difference between decimal, float and double in .NET?