... all I'm offering is the truth. Nothing more. RSS 2.0
# Thursday, June 11, 2009

I was doing some rudimentary math solutions in C# the other day and was looking at the System.Math namespace in the hope of finding a MOD (modulo) method but came up blank. I started down the C programming path of using % but then realized that System.Math.DivRem was the new name for what I needed.

int remainder,result;
result = Math.DivRem(10, 3, out remainder);
Console.WriteLine(result.ToString()); //gives 3
Console.WriteLine(remainder.ToString()); //gives the remainder of 1

I need to make a concerted effort to have a more in depth look at the various .NET name spaces and the shortcuts they provide to common problems. Most of my opinions on programming are heavily informed by the functional programming construct of C and to a lesser extent VB … may be that is not such a bad thing?

Technorati Tags:

Thursday, June 11, 2009 1:22:56 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] - Trackback
C#
Comments are closed.
Blogroll
Statistics
Total Posts: 334
This Year: 22
This Month: 0
This Week: 0
Comments: 32
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Mark Downie
Sign In
All Content © 2010, Mark Downie
DasBlog theme 'Business' created by Christoph De Baene (delarou)