Basic Archives - Code Maze https://code-maze.com/category/basic/ Learn. Code. Succeed. Sun, 02 Jun 2024 05:46:42 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.5 https://code-maze.com/wp-content/uploads/2020/01/Code-Maze-Favicon.png Basic Archives - Code Maze https://code-maze.com/category/basic/ 32 32 How to Print a 2D Array to the Console in C# https://code-maze.com/csharp-print-2d-array-to-the-console/ https://code-maze.com/csharp-print-2d-array-to-the-console/#respond Sun, 02 Jun 2024 05:46:42 +0000 https://code-maze.com/?p=116934 In this article, we will learn how to print a 2D array to the console using C#. Whether we are handling complex data structures or simply organizing information efficiently, understanding how to manipulate 2D arrays is a valuable skill. Let’s begin. Understanding 2D Arrays First, let’s understand what 2D arrays are. A 2D or two-dimensional […]

The post How to Print a 2D Array to the Console in C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-print-2d-array-to-the-console/feed/ 0
How to Generate a Random Color Name in C# https://code-maze.com/csharp-generate-a-random-color-name/ https://code-maze.com/csharp-generate-a-random-color-name/#comments Wed, 15 May 2024 22:31:28 +0000 https://code-maze.com/?p=116796 In this article, we will learn how to generate a random color name using the KnownColor enumeration. This enum is particularly useful in UI design and data visualization, as it provides a wide variety of preset colors. Let’s begin. Understanding the KnownColor Enumeration To understand why we would even need to generate a random color […]

The post How to Generate a Random Color Name in C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-generate-a-random-color-name/feed/ 1
Improvements in the Using Directive for Additional Types in C# https://code-maze.com/csharp-improvements-in-the-using-directive-for-additional-types/ https://code-maze.com/csharp-improvements-in-the-using-directive-for-additional-types/#respond Sat, 13 Apr 2024 05:44:04 +0000 https://code-maze.com/?p=116257 The “using” directive in C# helps us reduce boilerplate code when referencing types and members that sit outside the context of our class. C# 12 further expanded on the using directive, allowing it to be used for additional types. In this article, we’ll start by looking at how “using” has been used so far in […]

The post Improvements in the Using Directive for Additional Types in C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-improvements-in-the-using-directive-for-additional-types/feed/ 0
Deep Dive into Conversions in C# With the Convert Class https://code-maze.com/csharp-conversions-convert-class/ https://code-maze.com/csharp-conversions-convert-class/#respond Mon, 01 Jan 2024 23:15:50 +0000 https://code-maze.com/?p=103775 As a statically typed language, C# imposes some limitations on variable types. After we declare a variable of a given type, we can only assign values of that type to it. For example, if we declare a variable of a textual type, we cannot assign values of a numerical type to it. There are, however, […]

The post Deep Dive into Conversions in C# With the Convert Class appeared first on Code Maze.

]]>
https://code-maze.com/csharp-conversions-convert-class/feed/ 0
Indexers in C# https://code-maze.com/csharp-indexers/ https://code-maze.com/csharp-indexers/#respond Wed, 14 Sep 2022 06:00:52 +0000 https://drafts.code-maze.com/?p=75017 In this article, we are going to learn about Indexers in C#, how to declare them in a class, struct, or interface, and overload them. We’re also going to learn what the differences between indexers and properties are. Let’s start. What Are Indexers and What Do Indexers in C# Do? We’re all used to dealing […]

The post Indexers in C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-indexers/feed/ 0
Type Checking and Type Casting in C# https://code-maze.com/type-checking-type-casting-csharp/ https://code-maze.com/type-checking-type-casting-csharp/#respond Fri, 05 Aug 2022 06:00:37 +0000 https://drafts.code-maze.com/?p=72992 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). Let’s start. Type Casting in C# In any statically-typed language, a value has an assigned type that can’t be changed […]

The post Type Checking and Type Casting in C# appeared first on Code Maze.

]]>
https://code-maze.com/type-checking-type-casting-csharp/feed/ 0
Ranges and Indices in C# https://code-maze.com/csharp-ranges-and-indices/ https://code-maze.com/csharp-ranges-and-indices/#respond Sat, 02 Jul 2022 07:02:27 +0000 https://drafts.code-maze.com/?p=70818 In this article, we are going to learn more about ranges and indices in C#, and how to use them to access a single or a range of elements in a sequence. We’ll also see how ranges and indices help us write cleaner and more readable code. Let’s dig in. What Are Indices? In C# […]

The post Ranges and Indices in C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-ranges-and-indices/feed/ 0
Types of Inheritance In C# https://code-maze.com/csharp-types-of-inheritance/ https://code-maze.com/csharp-types-of-inheritance/#comments Thu, 17 Mar 2022 06:00:00 +0000 https://drafts.code-maze.com/?p=66999 In this article, we are going to describe the types of inheritance in C# and their use in various scenarios. Let’s dive in. What is Inheritance in C#? The inheritance is one of the main object-oriented programming paradigms, and it permits the reuse of the same code in more than one class. This way, instead […]

The post Types of Inheritance In C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-types-of-inheritance/feed/ 1
Params Keyword in C# https://code-maze.com/csharp-params-keyword/ https://code-maze.com/csharp-params-keyword/#comments Tue, 22 Feb 2022 06:30:17 +0000 https://drafts.code-maze.com/?p=66340 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? params is a special keyword that allows passing a variable number of parameters into a method. It allows a nice, flexible syntax that helps us specify: One […]

The post Params Keyword in C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-params-keyword/feed/ 1
How to Convert Int to String in C# https://code-maze.com/csharp-convert-int-to-string/ https://code-maze.com/csharp-convert-int-to-string/#respond Sun, 20 Feb 2022 06:49:46 +0000 https://drafts.code-maze.com/?p=65890 In this article, we are going to talk about how to convert int to string in C#. Int is an alias of the Int32 type, which represents a whole number, while string representing a collection of characters, simply defined as text. When we want to show a number on the screen, which is stored in […]

The post How to Convert Int to String in C# appeared first on Code Maze.

]]>
https://code-maze.com/csharp-convert-int-to-string/feed/ 0