Tuesday, October 15, 2024 01:10

Archive for January, 2020

Func and Action

Wednesday, January 29th, 2020

There are five builtin delegate types that you can use in C#: Delegate, MulticastDelegate, Predicate, Func and Action. I’ve already described Delegate in a previous lesson. MulticastDelegate is there only for historic reasons, and it allows us to chain up delegates, but you will rarely or never use it directly.… Read more

Delegate chaining

Friday, 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

Sunday, 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

Thursday, 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

Saturday, 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

Saturday, 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

Friday, 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

Friday, 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


Follow the white rabbit