Code Maze Author

Martin Chege

Martin has over seven years of experience designing, and developing .NET web applications. His experience includes building electronic health record systems. Besides his every-day job as a cyber security professional, he enjoys learning new technologies and contributing to discussion forums.
Also find me here:

MY ARTICLES:

LINQ Except in C#: Find Differences Between Collections

The LINQ Except() method finds the set difference between two sequences. It returns a new sequence with the elements of the first sequence that are not in the second one, and it returns each of those elements only once. It comes in handy when we compare collections in...

Fastest Ways to Perform Base 10 Conversions in C#

Performing base 10 conversions is fundamental when learning basic computer science and mathematical concepts. Since we know computer systems understand binary, such conversions can help us form different number representations that we can use for various applications...

Remove the Last Character of a String in C#

Removing the last character of a string in C# is a single expression: inputString[..^1]. The range operator on a string compiles to Substring(0, Length - 1), so it is the call the framework has always had, with less to type and one fewer place to get the arithmetic...

How to Get the Quarter of a Given Date in C#

Manipulating DateTime values is one of the most common operations in any application. Have we ever asked ourselves how to extract the quarter of a given date value in C#? In this article, we are going to understand how we can derive the quarter and financial quarter...

Comparing for and foreach Loops in C#

In this article, we will compare the for and foreach loops. Iterating through arrays and lists is fundamental when learning any programming language. C# offers different ways to achieve this, such as using while, for, and foreach statements. But, what about the...

How to Check if Items of a List Exist in Another List in C#

One of the programming scenarios we can encounter once in a while is checking whether certain items in a list exist in another. This article is going to dive deep into all the techniques to compare lists. We are also going to compare how these techniques perform and...

PeriodicTimer in C#: Async Ticks, Cancellation and Testing

PeriodicTimer is a .NET timer that we await instead of handing it a callback. We call WaitForNextTickAsync() in a loop, do our work on each tick, and the loop ends when we cancel a token or dispose of the timer. We need this kind of loop whenever a task has to run at...