Geeks With Blogs

News My Blog has been MOVED to

Michael Freidgeim's OLD Blog My Blog has been MOVED to
In our old code I'vew noticed a few examples of code like the following:
 MyFortune = Decimal.Add(MyFortune, .01m);
I was wandered, why they didn't use "+" sign, and didn't find any explanation.
The MSDN reference documentation doesn't explain, that methods like Add, Subtract,Multiply,Divide usually should not be called explicitely. 
Instead of using Add method it's simpler to use + sign ( Addition Operator ).
    MyFortune = Decimal.Add(MyFortune, .01m);
can be rewritten as 
    MyFortune += .01m;

Comment like this should be added to all methods, that have corresponding operators.

I've posted a suggestion to MS Feedback

Posted on Friday, June 19, 2009 8:02 PM .Net Framework | Back to top

Comments on this post: MSDN documentation -methods that have corresponding operators shouldn't be called directly

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Michael Freidgeim | Powered by: