What would be the benefit of using decimal.compare vs. just using a > or < to compare to variables?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In the CLI, decimal is not a native type like Int32, String, and others are. I am guessing that C# uses Compare behind the scenes to implement the comparison operators.
Also, you can pass Compare as a parameter to a sort routine without creating a delegate, reducing the method-nesting levels inside the sort.
That’s a couple of things off the top of my head.