by Janice Friedman | Sep 6, 2016 | Tutorials
The Stopwatch Class is a really useful way to measure elapsed time in C#. It can be used to keep track of average request times, to send messages to the user based on how long an action might take, or to benchmark your code. Often the DateTime method (which is used to...
by Janice Friedman | Aug 23, 2016 | Tutorials
The C# null-coalescing operator ?? supplies a fallback when a value is null. In color ?? “White”, the expression returns color when it has a value and “White” otherwise. The examples use C# 8 or later for nullable reference annotations and ??=....
by Janice Friedman | Jul 20, 2016 | Tutorials
C# Params Though both ref and out parameters are used to pass arguments through a method, the C# params aren’t used in exactly the same way. Ref keywords are used to pass an argument as a reference, meaning that when the value of that parameter changes after...
by Janice Friedman | Jun 18, 2016 | Tutorials
In C#, tuples are used to store data. It’s sort of like a variable, but in order for it to be a tuple, it must contain more than one value. Each instance of a tuple has a fixed number of items within it (and each item has its own distinct type, eg. a variable or...
by Janice Friedman | Jun 8, 2016 | Lessons
Working with value types and data can sometimes be challenging because a value type doesn’t normally hold a null value. This lesson shows you how to overcome this limitation with C# nullable types. Here’s what you’ll learn. Understand the problem...