Author: Marinko Spasojevic

C# Intermediate – Interfaces in C#

Inheriting from a class is a powerful mechanism, but the real inheritance power comes from an interface. An interface provides the members that a class which inherits from an interface must implement. We can look at the interface as a contract which states that a class that implements an interface must implement all the members from it. If you want to see complete navigation of this tutorial, you can do that here C# Intermediate Tutorial. To download the source code, you can visit Interfaces in C# Source Code.  We are going to split this article into the following sections:...

Read More

C# Intermediate – Inheritance in C#

Inheritance is one of the three key concepts in an object-oriented programming. We can use inheritance to avoid repetition when different classes have a number of features in common and are related to each other. In this post, we are going to talk about C# inheritance, why is it important and what we can use it for. If you want to see complete navigation of this tutorial, you can do that here C# Intermediate Tutorial. To download the source code, you can visit Inheritance in C# Source Code.  We are going to split this article into the following sections:...

Read More

C# Intermediate – Enumerations in C#

Besides the structures, C# supports another value type Enumeration. In this article, we are going to talk more about Enumerations in C#. If you want to see complete navigation of this tutorial, you can do that here C# Intermediate Tutorial. To download the source code, you can visit Enumerations in C# Source Code.  We are going to split this article into the following sections: Working with Enumerations Choosing Enumeration Literal Values Choosing an Enumerations Underlying Type Conclusion Working with Enumerations in C# Suppose we need to represent days in a week in our C# project. We can use an...

Read More

C# Intermediate – Structures in C#

In the previous articles, we have learned about classes, how to use them and how to create an object as an instance of a class. In this article, we are going to talk about structures which are similar to classes but have some differences as well. If you want to see complete navigation of this tutorial, you can do that here C# Intermediate Tutorial. To download the source code, you can visit Structures in C# Source Code.  We are going to split this article into the following sections: Working with Structures Structure Declaration Differences Between Classes and Structures When...

Read More

Implementing Action Filters in ASP.NET Core

Filters in .NET offer a great way to hook into the MVC action invocation pipeline. Therefore, we can use filters to extract code which can be reused and make our actions cleaner and maintainable. There are some filters that are already provided by .NET like the authorization filter, and there are the custom ones that we can create ourselves. There are different filter types: Authorization filters – They run first to determine whether a user is authorized for the current request Resource filters – They run right after the authorization filters and are very useful for caching and performance Action filters...

Read More