How to Check if a String Ends With a Number in C#
Checking if a string ends with a number in C# is a very common operation. In this article, we are going to show various ways in which we can do this. [sc name="github"...
MY ARTICLES:
Checking if a string ends with a number in C# is a very common operation. In this article, we are going to show various ways in which we can do this. [sc name="github"...
The HashSet<T> and SortedSet<T>Â classes in the System.Collections.Generic namespace define two ways of storing and iterating over a collection of objects in C#. Both classes have pros and cons, so which one should we use? This article is going to compare...
System.Linq.Dynamic.Core lets us write LINQ queries as strings. Where typed LINQ takes a lambda, Where(e => e.Department == "IT"), the library takes text, Where("Department == @0", "IT"), and parses it into the same expression tree. We need that when the shape of a...
In this article, we are going to learn about IDisposable objects and how to manage them in C#. While developing applications in C# or any...
In this article, we're going to learn about the using static directive feature in C#. Let's dive in. What Is a âusing staticâ Directive? In...
In this article, we are going to learn about how we can return null from a generic method in C#. Let's start. Can We Return null From a...
In this article, we are going to find out what null-coalescing operator ?? and null-coalescing assignment ??= operators are and how to use them. [sc name="github" url="https://github.com/CodeMazeBlog/CodeMazeGuides/tree/main/csharp-operators/NullCoalescingOperator"...
A SortedSet in C# is a data structure that allows us to store and access elements in sorted order. In this article, we are going to explore how to create and use the SortedSet class in C#. We are also going to look at some of the benefits and drawbacks of using this...
In this article, we're going to learn how to use HTML Agility Pack in C# and review some examples of its most important features. ...
In this article, we are going to look at the main differences between Tasks and Threads. They are both used for concurrent programming, but Tasks were later introduced with .NET Framework 4. [sc name="github"...
Concurrent Collections in C# are a set of collections designed for synchronized multi-thread access. We can find concurrent collections under the System.Collections.Concurrent namespace. Nowadays, where it is getting increasingly important and accessible to work in a...
A HashSet<T> in C# is a collection that holds each value at most once and finds any of them in constant time on average. Adding a value that is already in the set changes nothing and tells us so. [sc name="github"...
Converting DataTable to JSON is one of those tasks that we come across from time to time and it seems like there should be a built-in method to do it. Unfortunately, that is not the case and we need to figure out a way to do it on our own. In this article, we will...
Use Dictionary<TKey, TValue>. It is type-safe, it does not box value types, and it is measurably faster and lighter than Hashtable at every size we tested. [sc name="github"...
In this article, we are going to talk about constructor overloading in C#. We'll look at the different ways to implement it in an application. While we look at constructor overloading in this article, we have an existing article on constructors that can act as a...
In this article, we will learn how to use OData with ASP.NET Core Web API services. OData (Open Data Protocol) is an open protocol that defines a set of best practices for building and consuming RESTful APIs. Initiated by Microsoft in 2007, it has become an OASIS...
In this article, we are going to look at some common C# programming mistakes. We are pretty sure that there are a lot more mistakes that developers make while writing their projects, but here, we will try to summarize the ones we often noticed while working with other...
Making websites multi-lingual allows users from around the globe to use our applications in their native language. In this article, we are going to see how ASP.NET Core provides us with the ability to enable localization to support different languages and cultures. ...
To capitalize the first letter of a string in C#, upper case the first character and copy the rest unchanged. string.Create() does it in a single allocation: string.Create(input.Length, input, static (chars, str) => { chars[0] = char.ToUpperInvariant(str[0]);...
In this article, we are going to learn about one of the most common exceptions in C# - IndexOutOfRangeException. We're going to...