Using a constant as a DateTime format inside string interpolation

I was upgrading some code to use string interpolation, a feature introduced in C# 6, when I ran into a small snag with DateTimes and a format string stored as a constant.

  Apr 4, 2019 (rev. Sep 16, 2025) ·  2 min

Using Attributes in C#

Ever thought it’d be convenient to attach metadata to your code at design time, then read it at runtime? Attributes let you do just that - to methods, classes, tests, enumerations, and more. Use reflection to read them at runtime and take some action. Here’s a few examples for the uninitiated…

  Apr 4, 2019 (rev. Sep 16, 2025) ·  10 min

Comparing Two Objects for Equality in C#

It’s common to compare two objects in C# for equality, such as for a save operation. Let’s take a closer look at how we define what equal means.

  Oct 31, 2016 (rev. Sep 16, 2025) ·  7 min

Implicit vs Explicit Conversion in C#

We use implicit and explicit conversion in C# all the time, without even realizing it. Let’s learn more about them and look at examples of each.

  Feb 11, 2015 (rev. Sep 16, 2025) ·  5 min

Obsolete Attribute on a Class is Ignored When an Interface is Involved

The Obsolete attribute on a class is ignored when an interface is involved. It caught me by surprise, but makes sense. Let’s see why.

  Feb 4, 2015 (rev. Sep 16, 2025) ·  3 min

An Extension Method to Pass a Column Name to SqlDataReader.GetFieldValue

Let’s combine the SqlDataReader’s GetFieldValue and GetOrdinal methods into an extension method that lets us pass a column name and get back a specific type.

  Jan 15, 2015 (rev. Sep 16, 2025) ·  3 min

Passing Data Between Forms in WinForms

Passing data between two Forms is very common in WinForms. There’s a couple ways to do it, and one’s better than the other. Let’s take a look.

  Dec 12, 2014 (rev. Sep 16, 2025) ·  6 min

Filtering a ListView in WPF Using a TextBox and CollectionViewSource

In WPF, a ListView allows for quite a bit of flexibility. Let’s take a look at filtering a ListView, using input being typed into a TextBox.

  Dec 7, 2014 (rev. Sep 16, 2025) ·  5 min