Comparing FirstOrDefault and SingleOrDefault

FirstOrSingleOrDefault

This is an EF Core experiment measured with the popular BenchmarkDotNet library. You will find the benchmark results and the source code to reproduce everything on your machine and answer the question on the performance impact of the System.Linq methods SingleOrDefault() vs FirstOrDefault(), especially in the case of an indexed column.

Generating The Fibonacci Sequence in C#

Fibonacci C# Experiments with BenchmarkDotNet

Fibonacci is a number sequence that starts with 0, 1, 1 and then the following number is the addition of the two preceding numbers: 0, 1, 1, 2, 3, 5, 8, 13.

We will look at different possible ways to generate this sequence in C#. We will also look into the yield keyword and how to use it.

You will see how you can use the most popular benchmarking library, BenchmarkDotNet, to observe the performance of the found solutions.