Applying the Decorator Pattern to a DataGridView

In this article, I present a simple example of how you can apply the Decorator Pattern to a DataGridView to extend its behavior without using inheritance. This article is not meant to be a tutorial on the Decorator Pattern. Rather, it is just a brief explanation of how I solved a particular design problem using a variation of the Decorator Pattern. With a bit of thought, the reader should be able to apply my design pattern to decorate other types of visual controls and components from the .NET Framework such as Button, CheckBox, ComboBox, Label, ListBox, ListView, Panel, TextEdit and TreeView.
Continue reading » Applying the Decorator Pattern to a DataGridView

Pages: 1 2 3 4

An Implementation of BitConverter.SingleToInt32Bits

Back in the day when I did more Java development, I used Apache’s Commons Lang regularly to do all kinds of things like string manipulations and implementing Object.equals() and Object.hashCode().

Not too long ago, I started working more with C# and the .NET Framework and I found myself wanting some of the functionality of Commons Lang for the .NET platform. The closest thing I could find was Artur Trosin’s port of the EqualsBuilder and HashCodeBuilder classes from Commons Lang to C#. Artur’s excellent port saved me a lot of work. He even provided ported unit tests, which was a nice touch.
Continue reading » An Implementation of BitConverter.SingleToInt32Bits

XtUnit Troubleshooting

I’m a big advocate of automated software testing with tools like the venerable JUnit for Java and the similar NUnit for the .NET languages such as C#.

Yesterday I was implementing some NUnit tests for a C# database access object (or DAO). If you have ever implemented such tests before you’ll probably agree with me that it’s important for your test data to be in a known and consistent state before every test run. Continue reading » XtUnit Troubleshooting