Category Archives: C#

C# – LINQ’s SequenceEqual

By | 31/05/2023

In this post, we will see what LINQ’s SequenceEqual is and how we can use it in our code.But first of all, what is LINQ’s SequenceEqual?LINQ’s SequenceEqual is a method used to determine if the elements of two sequences are equal.It is important to highlight two things:1) it is possible to use any type of… Read More »

Category: C#

C# – Stopwatch

By | 05/04/2023

In this post, we will see what StopWatch is and how we can use it.But first of all, what is StopWatch?The Stopwatch class is a high-resolution timer provided by the .NET Framework, designed to measure the elapsed time for an operation or a block of code. It’s part of the System.Diagnostics namespace and offers greater… Read More »

Category: C# Tags:

C# – The fastest ways to iterate a List

By | 22/03/2023

In this post, we will see the fastest ways to iterate a List. We start creating a Console Application called ReadList and then, we add a Class called Core: [CORE.CS] Now, we will add four methods to iterate the List using the statements For, Foreach, List<T>.Foreach and Foreach with CollectionsMarshal.AsSpan: FOR(We are not sure that… Read More »

Category: C# Tags:

C# – Big O notation

By | 08/02/2023

In this post, we will see what Big O notation is and how to use it to optimize our algorithms.But first of all, what is Big O notation?From Wikipedia:“Big O notation is a mathematical notation that describes the limiting behaviour of a function when the argument tends towards a particular value or infinity. Big O is a member of a family of notations invented by Paul Bachmann,… Read More »

C# – BenchmarkDotNet

By | 07/12/2022

In this post, we will see how to use the library BenchmarkDotNet for testing the performance of our methods.But first of all, what is BenchmarkDotNet?“BenchmarkDotNet is a lightweight, open-source, powerful .NET library that can transform our methods into benchmarks, track the performance, and then provide insights into the performance data captured”.I want to specify that… Read More »

Category: C# Tags:

C# – 11

By | 09/11/2022

In this post, we will see two interesting features introduced with C# 11.For the complete list of all new features, go to the Microsoft web site. In order to use C# 11, we have to install .NET 7.0 that we can download here:https://dotnet.microsoft.com/en-us/download/dotnet/7.0 We select our OS (in my case Windows x64), we download the… Read More »

Category: C# Tags:

C# – Code Snippets

By | 02/11/2022

In this post, we will see how to use Code Snippets and how to create a custom one.But first of all, what is a Code Snippet?From Microsoft web site:“Code snippets are ready-made snippets of code you can quickly insert into your code. For example, the for code snippet creates an empty for loop.You can insert a code snippet at… Read More »

Category: C# Tags:

C# – How to ping an IP/Address with .NET Core

By | 28/09/2022

In this post, we will see how to ping an IP or Address with .net Core. We start creating a Console application called CheckIP where, we will define a class called CheckService so defined: [CHECKSERVICE.CS] Finally, we modify Program.cs in order to use the class CheckService: [PROGRAM.CS] We have done and now, if we run… Read More »

Category: C# Tags: