C# – How to check if an item exists in a list

In this article we’ll present and compare two functions which offer us a possibility to check whether an item exists in a given list. These functions are Exists and Contains, both available in System.Collections.Generic namespace. Provided examples are for two different lists: one containing integers and other one containing objects of custom created class. List … Continue reading C# – How to check if an item exists in a list

C# – How to initialize an array

Array is a fixed size collection of variables representing the same type. Array can store both built-in primitive types (like integer) and custom objects. In this article we’ll present different ways of initializing such arrays. Array of integers Let’s consider an array of integers. Below are presented five different methods of creating 3 elements array, … Continue reading C# – How to initialize an array

How to get started with BenchmarkDotNet using a simple example

BenchmarkDotNet has become the de facto standard for performance benchmarking on .NET. Nearly every video or blog post which Microsoft developers do which has some performance benchmarking uses it. It’s really easy to get started… 1 – Install BenchmarkDotNet from NuGet2 – Create a class which will contain your methods3 – Use the [Benchmark] attribute … Continue reading How to get started with BenchmarkDotNet using a simple example