ASP.NET

Predicate vs Func in C#

In C#, a predicate is a delegate (a type that refers to a method) or a lambda expression that takes a single parameter and returns a Boolean value indicating whether the input meets certain criteria. For example, the code below defines a predicate that tests if a given integer is even: A func, on the […]

Predicate vs Func in C# Read More »

Null-coalescing operator in C#

You can use the null-coalescing operator (??) to provide a default value for a nullable type or reference type. The null-coalescing operator returns the left-hand operand if it is not null, or the right-hand operand if the left-hand operand is null. Here is an example of how to use the null-coalescing operator: This is equivalent

Null-coalescing operator in C# Read More »

Array vs ArrayList in C#

In C#, an Array is a collection of items that are stored in a contiguous block of memory. It is a fixed size, meaning that you must specify the size of the array when you create it, and you cannot change the size of the array later. Arrays are also index-based, meaning that you access

Array vs ArrayList in C# Read More »

CONST vs READONLY in C#

const and readonly are two very useful keywords in C# that as a .NET developer you might see in any real-world application. When used within the same class, these keywords often confuse us as developers. But, what are the similarities and differences between const and readonly? Declaring CONST vs READONLY Per definition, Constants are immutable values

CONST vs READONLY in C# Read More »

Scroll to Top