
Recent Posts

Recent Comments
 RodStephens on Make a 3D globe in WPF and C#
 Make an intuitive extension method to draw an elliptical arc in WPF and C#  C# HelperC# Helper on Calculate where a line segment and an ellipse intersect in C#
 Juergen Schroether on Make a 3D globe in WPF and C#
 RodStephens on Make drawing extension methods in WPF and C#
 Angel on Make drawing extension methods in WPF and C#
Archives
 May 2019
 April 2019
 March 2019
 February 2019
 January 2019
 December 2018
 November 2018
 October 2018
 September 2018
 August 2018
 July 2018
 June 2018
 May 2018
 April 2018
 March 2018
 February 2018
 January 2018
 December 2017
 November 2017
 October 2017
 September 2017
 August 2017
 July 2017
 June 2017
 May 2017
 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
 February 2014
 January 2014
 December 2013
 October 2013
 August 2013
 June 2013
 December 2012
 September 2012
 July 2012
 June 2012
 November 2011
 May 2011
 April 2011
 February 2011
 December 2010
Categories
 .NET
 3D
 3D graphics
 ADO.NET
 algorithms
 animation
 API
 arrays
 attributes
 audio
 books
 C#
 C# programming
 calculations
 challenges
 classes
 clipboard
 coding
 combinatorics
 console
 controls
 cryptography
 curve fitting
 database
 debugging
 dialogs
 directories
 Drag and Drop
 drawing
 drawings
 enums
 Event
 events
 example program
 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
 threedimensional graphics
 tips
 tools
 transformations
 Uncategorized
 user interface
 variables
 VBA
 web
 Windows Forms programming
 WMI
 Word
 wpf
 XAML
 XML
Meta
Category Archives: calculations
Control a loop that uses floatingpoint values in C#
Sometimes you might need to use a floatingpoint variable that loop over a range of values. For example, you might want a value to step through the values 0.0 through 1.0 in increments of 0.1. The sequence of numbers would … Continue reading
Posted in calculations, mathematics, variables
Tagged C#, C# programming, calculations, double, example, example program, float, floatingpoint, for loop, loop, mathematics, rounding, rounding errors, variables, Windows Forms programming
Leave a comment
Compare floatingpoint values safely in C#
The computer stores values, including floatingpoint values, in binary using 0s and 1s. That means it cannot store all possible decimal values exactly. Sometimes when you multiply or divide two floatingpoint values, the computer is unable to store the result … Continue reading
Calculate credit payments in WPF and C#
This is a WPF version of the example Calculate credit payments in C#. The calculations are the same. Unfortunately building and using the user interface is much harder in WPF, particularly working with the ListView control. (The unofficial WPF slogan: … Continue reading
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
Posted in algorithms, calculations, finance, mathematics
Tagged algorithms, C#, C# programming, calculations, credit, credit card, credit payments, example, example program, finance, interest, mathematics, payments, Windows Forms programming
9 Comments
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