I suppose, this post will be the shortest of all. Today, I would like to explain to you what stands for sealed keyword. Sealed The explanation is very simple and intuitive – the classes that are marked with this modifier are just treated as sealed. It means that they can not be base classes for …
Category: C# Lessons
Ref vs out #L5
Another short post about ref and out – keywords that are used to pass parameters to functions.Using them we have to also remember that in both cases, the parameters are passed as references (address) and not values. Ref In the case of ref, the variable must be initialized before passing it as a parameter. With …
Const vs readonly #L4
Today, we will describe very shortly what are the differences between const and read only – used to declare immutable variables. Const The value of the constant is assigned during compilation. In binary code, specific values appear instead of a variable. The value can only be assigned during the declaration. The const values can’t be …
Concat vs union #L3
Okay, so let’s assume that you have some two lists. And now, you would like to merge them into one. The Concat method combines two collections into one. However, it doesn’t perform any other operations. It simply returns one collection containing elements from two collections. The Union method not only combines the two collections into …
The simplest explanation of the reflection #L2
At first, it took me some time to understand what is the reflection and how it works. Here, I will try to give you very short and simple definition: Reflection is a mechanism that allows us to access the structure (classes, methods, resources) of a given assembly during the program’s operation. Thanks to it, we …
Abstract class vs interface #L1
Beginner programmers often have a problem understanding the differences between the abstract class and the interface. In this post I will try to explain what these differences are. What is the abstract class? An abstract class is a class for which we can not create an object. Just like an ordinary class, it can contain …