Latest Posts On Code Maze

Type Checking and Type Casting in C#

Type Checking and Type Casting in C#

In this article, we are going to learn various ways of converting a value from one type to another (type casting) and how to check the type of a value at run time (type checking). IOptions is a useful interface that enables us to pass on configuration values more...

How to Implement Lucene.NET

How to Implement Lucene.NET

In this article, we are going to be learning how to implement Lucene.NET in C#. We will cover the entire process from installing the library, to indexing and searching. .NET 7 Preview 6 has introduced a new caching middleware. Let's see how it works in this...

How to Convert String Array to String in C#

How to Convert String Array to String in C#

In this article, we are going to learn how to convert a string array to a string in C#. We will cover five different approaches to achieve the same result, and in the end, we will inspect benchmark results to see the fastest way to accomplish the conversion.  ASP.NET Core Web API comes out with some powerful inbuilt features....

Covariance and Contravariance in C#

Covariance and Contravariance in C#

In this article, we’re going to learn why covariance and contravariance are important, what they are, and how to use them in various scenarios using a few examples. [sc name="github"...

How to Turn a C# Object Into a JSON String in .NET?

How to Turn a C# Object Into a JSON String in .NET?

In this article, we're going to learn how to serialize a C# object into a JSON string using the two main JSON libraries in the .NET ecosystem. Also, we're going to learn how to control different aspects of the serialization process. [sc name="patreon-source-code"...

Constructors in C#

Constructors in C#

In this article, we will discuss Constructors in C# and different types of constructors. More importantly, we will discuss these constructors' differences and use cases. [sc name="github"...

Unsafe Code in C# (unsafe keyword)

Unsafe Code in C# (unsafe keyword)

In this article, we are going to learn about the unsafe code in C#. In general, the code that we write in C# is safe code. It creates managed objects and doesn't access the memory directly. On the other hand, unsafe code in C# is code that is not in direct control of...

Using Moq to Determine If a Method is Called

Using Moq to Determine If a Method is Called

In this article, we are going to see how to determine if a method is called during test execution. To do that, we are going to use Moq and its verification APIs. [sc name="github"...

Code Maze Weekly #129

Code Maze Weekly #129

Issue #129 of the Code Maze weekly. Check out what's new this week and enjoy the read. We've introduced a new section "YouTube" since there are some quality content developers over there as well. Hope you'll like it. .NET and C# Returning XML from minimal APIs in .NET...