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.
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.
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…
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.
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.
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.
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.
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.
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.