
Recent Posts

Recent Comments
Archives
 April 2017
 March 2017
 February 2017
 January 2017
 December 2016
 November 2016
 October 2016
 September 2016
 August 2016
 July 2016
 June 2016
 May 2016
 April 2016
 March 2016
 February 2016
 January 2016
 December 2015
 November 2015
 October 2015
 September 2015
 August 2015
 July 2015
 June 2015
 May 2015
 April 2015
 March 2015
 February 2015
 January 2015
 December 2014
 November 2014
 October 2014
 September 2014
 August 2014
 July 2014
 June 2014
 May 2014
 March 2014
 February 2014
 January 2014
 December 2013
 November 2013
 October 2013
 September 2013
 August 2013
 July 2013
 June 2013
 May 2013
 April 2013
 March 2013
 February 2013
 January 2013
 December 2012
 November 2012
 October 2012
 September 2012
 August 2012
 July 2012
 June 2012
 May 2012
 April 2012
 January 2012
 December 2011
 November 2011
 May 2011
 April 2011
 February 2011
 December 2010
Categories
 .NET
 ADO.NET
 algorithms
 animation
 API
 arrays
 attributes
 audio
 books
 calculations
 challenges
 classes
 clipboard
 coding
 combinatorics
 console
 controls
 cryptography
 curve fitting
 database
 debugging
 dialogs
 directories
 Drag and Drop
 drawing
 drawings
 enums
 Event
 events
 Excel
 extension methods
 extensions
 files
 finance
 fonts
 formatting
 forms
 fractals
 ftp
 games
 GDI+
 generic
 geometry
 globalization
 graphics
 html
 IDE
 image processing
 inheritance
 interfaces
 internationalization
 internet
 interoperability
 LINQ
 lists
 localization
 mathematics
 memory
 menus
 MessageBox
 methods
 miscellany
 multimedia
 network
 Office
 OOP
 operators
 parsing
 performance
 phone
 PowerPoint
 printers
 printing
 productivity
 programs
 puzzles
 recursion
 reflection
 registry
 regular expressions
 serialization
 settings
 SQL
 stories
 strings
 syntax
 system
 threading
 tips
 tools
 transformations
 Uncategorized
 user interface
 variables
 VBA
 web
 Windows Forms programming
 WMI
 Word
 wpf
 XAML
 XML
Meta
Category Archives: calculations
Define and use bit masks in C#
The example Understand bit masks in C# explains how to use bit masks. To define a bit mask, simply create an enum and give it the Flags attribute as in the following code. [Flags] private enum BitmaskEnum { Value1 = … Continue reading
Understand bit masks in C#
Some values, including some properties defined by the .NET Framework, are bit masks. That means each bit in a value means something. For example, the AnchorStyles enumeration that determines how controls are anchored in their parents defines four values: Top, … Continue reading
Use bit operations in C#
C# defines several operators that perform bit operations. As you may be able to guess from the names, these operators manipulate the bits in an integer value. They operate on the value’s bits separately so they are sometimes called “bitwise … Continue reading
Posted in calculations, mathematics, variables
Tagged and, bit operations, bit shift, bitwise operations, C#, C# programming, calculations, example, example program, mathematics, or, variables, Windows Forms programming, xor
Leave a comment
Compare speeds of arithmetic operations in C#
This example compares the speeds of arithmetic operations with different data types. There’s a big difference between the speeds of operations using the decimal data type and the other types, so performing a loop a certain number of time is … Continue reading
Posted in algorithms, calculations, mathematics
Tagged algorithms, arithmetic, arithmetic operations, byte, C#, C# programming, calculations, data types, decimal, double, example, example program, float, integer, long, mathematics, Windows Forms programming
Leave a comment
Calculate credit payments in C#
For each month the program: Calculates the payment first. This is either a percent of the balance or the minimum amount, whichever is greater. Calculates interest after the payment is calculated but before it is subtracted from the balance. Adds … Continue reading
Make a stacked graph showing compound interest in C#
The example Show compound interest graphically in C# displays a graph showing contributions, compound interest, and total balance over time for a monthly investment strategy. This example may provide a better representation than that one. It shows the total contributions … Continue reading
Show compound interest graphically in C#
This is a more graphic version of the example Calculate the value of a monthly investment in C#. Instead of adding values to a ListView control, this example saves points in three lists of points: Balance, Contributions, and Interest. It … Continue reading
Calculate the value of a monthly investment in C#
The magic of an investment with compound interest is that, over time, you get interest on the interest. For each month this program calculates the interest on the account balance. It then adds the interest and a monthly contribution to … Continue reading
Make generic Min and Max methods in C#
This example shows how you can make generic Min and Max methods to find the minimum and maximum values in a sequence of parameters. The Math namespace’s Min and Max methods are very useful, but they have two big drawbacks. … Continue reading
Posted in algorithms, arrays, calculations, generic, methods
Tagged algorithms, arrays, C#, C# programming, calculations, example, example program, generic, generic methods, Max, maximum, methods, Min, minimum, Windows Forms programming
Leave a comment
See how much time a checked block takes in C#
The post Control overflow behavior with checked and unchecked in C# explains how to use checked blocks to watch for integer overflow. If you don’t use checked, the program may encounter integer overflow errors without you knowing it. It seems … Continue reading