Code Maze Author

Code Maze

This is the standard author on the site. Most articles are published by individual authors, with their profiles, but when several authors have contributed, we publish collectively as a part of this profile.
Also find me here:



MY ARTICLES:

Composition vs Inheritance in C#

Composition and Inheritance are programming techniques to establish relationships between different classes. When working with an object-oriented language like C#, it is natural that we come across classes and objects. These classes, more than often, need to interact...

Difference Between DateTime.Now and DateTime.UtcNow in C#

In this article, we’re going to learn about the difference between DateTime.Now and DateTime.UtcNow in C#. Additionally, on a more general level, we're going to learn the difference between formatting DateTime values in local time vs in universal time, and also how to...

How to Copy Array Elements to New Array in C#

In this article, we are going to learn how to copy array elements to a new array in C#. We are going to see many different ways to accomplish this task, and at the end, we will do a benchmark to check which is the best way to copy elements from one array to another....

Difference Between ValueTuple and Tuple in C#

In this article, we are going to take an in-depth look at the difference between ValueTuple and Tuple. We are also going to look at extra features that came with ValueTuples and also some potential drawbacks. To download the source code for this...

Switch Expression With Multiple Cases With the Same Result in C#

In this article, we are going to learn how to create a switch expression with multiple cases that have the same result. We can combine the cases inside the switch statement either in a relational pattern or a constant pattern. With the relational pattern, we compare...

Difference Between int.Parse() and Convert.ToInt32() in C#

In this article, we are going to talk about the difference between int.Parse() and Convert.Toint32(). Both the int.Parse() and the Convert.ToInt32() methods are used to convert a string to an integer. Although the two methods are used for the same purpose, there are,...

DateTime Operators in C#

Manipulating DateTime values is one of the most common operations in a lot of applications. In this article, we are going to learn about the DateTime operators in C# that can come in handy when manipulating DateTime values in .NET (Core). To...

Top-Level Statements in C#

In this article, we are going to learn about the top-level statements in C#. Whenever we start learning a new programming language, the first thing we write is usually a "Hello World" statement. And if we are talking about C#, there's a lot of required code we need to...

Parse and TryParse in C#

Often, our applications depend on external data sources that provide the string representations of .NET types. We have an option of using the Parse and TryParse methods to convert these string representations back to the base .NET types.  The strings can be of any...

ILogger, ILoggerFactory, and ILoggerProvider in .NET

In this article, we are going to discuss how we can use the logging API in a .NET application and the three important interfaces of this API - ILogger, ILoggerFactory, and ILoggerProvider. Logging is an important part of every application. It helps us identify the...

Catch Multiple Exceptions in C#

In this article, we are going to learn about different ways to catch multiple exceptions in C#. Utilizing try-catch block is the best way to manage exceptions. It also enables developers to manage exceptions however they want. Using a single catch block is one of the...

Serializing Objects to XML in C#

In this post, we are going to learn about serializing objects to XML in C#. So, what is XML Serialization?  It is the transformation of the public fields and property values of an object (without type information) into an XML stream. To download...

Break and Continue Statements in C#

In C#, we use the break and continue statements to control the flow of iterations in our code. Both commands help us to stop an iteration of our code. While the break statement stops an iteration and "breaks" out from the entire parent loop in which it appears, the...

Required Query String Parameters in ASP.NET Core

In this article, we’re going to talk about the required query string parameters. We are going to learn how to make query string parameters mandatory and explore the options we have in ASP.NET Core. To download the source code for this article, you...

Selection Sort in C#

Sorting is one of the most common problems that programmers solve while building applications. Selection sort is one of the algorithms that we can use to sort elements in an array. We are going to learn how to implement selection sort in C# and analyze how the...

Tuple in C#

In this article, we are going to deconstruct the concept of Tuple in C#. Let's dive in. What is Tuple in C# Tuple in C# is a reference-type data structure that...

API Versioning in ASP.NET Core

In this article, we’re going to talk about API versioning and explore the options we have in ASP.NET Core. So, let's start. [sc name="videolink"...

Math Class in C#

In this article, we are going to describe the Math class in C#. The Math class in C# contains lots of useful static methods for performing all sorts of calculations. We'll briefly describe all the methods in the library with some examples, so it will be quite a long...

Check if DateTime Is Weekend or Weekday

In this article, we are going to find out how to check if a DateTime is a Weekend or a Weekday. Most programming languages work very well with numeric or textual data. But not all of them have the tools for handling information in the form of dates and times.  Luckily...