Latest Posts On Code Maze

Convert Byte Array to File in C#

Convert Byte Array to File in C#

Oftentimes, we find ourselves with a chunk of data in a byte array that needs to be stored in a file. This is usually for the sake of storage or for further processing. Let's consider a few different ways to convert a byte array to a file. To...

Code Maze Weekly #114

Code Maze Weekly #114

Issue #114 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Classes, Structures, and Records, Oh My! [dotnettips.wordpress.com] Do you know the main difference between Class and Structure? Do you know when to use Records? David...

How to Add Parameters to a String in C#

How to Add Parameters to a String in C#

In this article, we are going to learn how to add parameters to a string in C# in a few different ways. Let's start Using String.Format() Method Firstly, we can...

Array Slicing in C#

Array Slicing in C#

In this article, we are going to talk about array slicing in C#. We are going to explore different ways to slice an array in C# with some examples. Let's start....

Using MassTransit with RabbitMQ in ASP.NET Core

Using MassTransit with RabbitMQ in ASP.NET Core

In this article, we are going to take a look at how we can use the open-source, distributed application library MassTransit in conjunction with RabbitMQ in an ASP.NET Core application. First, we are going to cover some of the more advanced RabbitMQ features, as well...

Custom Attributes in .NET

Custom Attributes in .NET

Custom attributes in .NET (Core) are a helpful mechanism to attach additional information to classes, structs, and even their members. In this article, we're going to explain how to create, access, and get the information from custom attributes in .NET through some...

Introduction to Unit Testing With NUnit in C#

Introduction to Unit Testing With NUnit in C#

In this article, we are going to learn about unit testing with NUnit in C# through examples. Testing is one of the essential parts of the software development cycle, and there are many different test types. We'll concentrate our attention on programmatic tests, such...

How to Convert String to Int in C#

How to Convert String to Int in C#

In this article, we are going to talk about how to convert string to int in C#. Int is an alias of Int32, and defines an integer number in range from -2,147,483,648 to +2,147,483,647. Setting a value of an int variable that is out of this range, will produce a "System...

Bubble Sort In C#

Bubble Sort In C#

Sorting arrays is quite a common problem in programming. The bubble sort algorithm is simple to implement as it involves comparing adjacent elements and swapping them when they are in the wrong order. We are going to learn how Bubble Sort in C# works.  [sc...

Code Maze Weekly #113

Code Maze Weekly #113

Issue #113 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Global usings in C# 10 [gunnarpeipman.com] Global using is one of the newest additions in C#. Gunnar Peipman explores this feature and shows us how it helps us. Step-up...

How to Use RabbitMQ in ASP.NET Core

How to Use RabbitMQ in ASP.NET Core

In this article, we are going to take a look at using a message broker, RabbitMQ, with an ASP.NET Core Web API application. Message brokers are...

Different Ways to Iterate Through a Dictionary in C#

Different Ways to Iterate Through a Dictionary in C#

Dictionary allows us to store items in a collection using key-value pairs. It is included in the System.Collection.Generic namespace. In this article, we are going to learn how to iterate through a Dictionary in different ways. To download the...

Minimal APIs in .NET 6

Minimal APIs in .NET 6

In this article, we are going to explain the core idea and basic concepts of the minimal APIs in .NET 6. But if we try to explain it in one sentence, it will be that it is an API without the need for a controller. Other than a theoretical explanation, we are going to...

DateTime Format In C#

DateTime Format In C#

In this article, we are going to learn how to work with DateTime format strings in C#. We can use format specifiers in C# to get string representations of DateTime values or to define the input string in a parse operation. The DateTime and DateTimeOffset classes in C#...

Code Maze Weekly #112

Code Maze Weekly #112

Issue #112 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Implementing an API Gateway in ASP.NET Core with Ocelot [dotnetthoughts.net] How to build an API Gateway in ASP.NET Core with Ocelot by Anuraj Parameswaran. Testing...

Debugging C# in Visual Studio

Debugging C# in Visual Studio

The code we write doesn't always work the way we want it to. It could be due to a syntactical error or a logical one. While the compiler generally points to the syntax-related errors and helps us fix them, logical errors aren't that straightforward. This is when we...

Using RestSharp To Consume APIs in C#

Using RestSharp To Consume APIs in C#

In this article, we’re going to learn about using RestSharp in a .NET project. RestSharp is an open-source HTTP Client library that we can use to consume APIs easily. RestSharp features automatic serialization and deserialization, request and response type...

Params Keyword in C#

Params Keyword in C#

In this article, we'll have a look at the params keyword in C#. We'll discuss the use cases and best practices. Let's dive in! What Is the 'Params' Keyword?...