Friday, June 13, 2025 08:53

Delegate chaining

January 24th, 2020

An useful property of delegate objects is that multiple objects can be assigned to one delegate instance using the + operator, process called delegate chaining.

Delegate chaining isn’t really useful until we will get to events and event subscribers, which will come in a future lesson, but it’s better to describe the behavior now, after you’ve seen a bit of delegates inner workings.… Read more

Lambda expressions

January 12th, 2020

In the previous lesson I was writing that we can further improve our code by using lambda expressions. A lambda expression is a convenient way of defining an anonymous (unnamed) function that can be passed around as a variable or as a parameter to a method call.… Read more

Delegates

January 9th, 2020

You already know from the lesson methods and functions and parameters that you can create methods that accept a number of parameters of different types. But what if you would want to send a method itself as a parameter to another method?… Read more

Interfaces

January 4th, 2020

Interfaces, just like C/C++ pointers, are one of those topics that beginners, and even intermediate programmers are afraid of, because they do not understand them. In fact, the truth is, they are simple to understand, and the real difficulty comes when asking the question “why should I use them/where should I use them?”.… Read more

Abstract classes and methods

January 4th, 2020

As I was explaining in the previous lesson, one way of achieving abstraction is trough the means of abstract classes and methods. The abstract keyword can be used for both classes and methods. An abstract class is a class that provides a partial implementation.… Read more

Abstraction

January 3rd, 2020

Another fundamental principle of Object Oriented Programming is abstraction. Abstraction mainly refers to the ability of using something without knowing or being interested about how that something does what we request of it. We do this every day: we do not care how a computer does all it does (well, actually, some of us do), we only care that it is able to do what we need from it.… Read more

Polymorphism

January 3rd, 2020

The third fundamental principle of Object Oriented Programming is called polymorphism.  At a fundamental level, polymorphy refers to the ability of having many forms, or to transform into many forms. It comes from the Greek terms poly, which means “multiple”, and morph, which means “shape” or “form”.… Read more

Encapsulation

December 19th, 2019

The second fundamental principle of Object Oriented Programming is called encapsulation.  Its main definition refers to the action of hiding anything that is not essential from the outside world. It is not very difficult to understand the fact that we do not need to expose everything when we build something.… Read more

Virtual Methods

December 8th, 2019

Virtual methods are methods that can be overridden in inheriting (derived) classes. By default, in .NET, methods are not virtual. In order to declare a method as virtual, we need to declare it using the keyword virtual, like so:

public virtual void MyMethod()
{
    Console.WriteLine("Felidae
Read more

Inheritance

November 17th, 2019

In the first lesson of the Objects chapter, I was discussing in a broad way about Object Oriented Programming, acronymed OOP, and I was enumerating it’s fundamental principles: encapsulation, inheritance, abstraction and polymorphism. In this lesson, I will explain inheritance at large, and how class hierarchies improve code readability and reusability.… Read more