Csharp .NET – Ordisoftware Engineering https://www.ordisoftware.com/en Agile creation of object-oriented applications Mon, 27 Oct 2025 19:31:48 +0000 en-US hourly 1 https://www.ordisoftware.com/uploads/2024/05/favicon-144x144.png Csharp .NET – Ordisoftware Engineering https://www.ordisoftware.com/en 32 32 191347058 Is everything an object in .NET and C#? https://www.ordisoftware.com/en/blog/2021/09/is-everything-an-object-in-dotnet-and-csharp/ Sat, 04 Sep 2021 12:37:53 +0000 https://www.ordisoftware.com/?p=7930

In .NET and C# all is object.

Simply said.

Even a value type, a struct, an interface and an enum.

One can not approve, but the point is that everything is object, except pointers/references, and literals from binary files, even CPU optimized primitive types, since it is the OOP Theory as well as the. NET specifications and therefore the facts.

About classes and types

From the dotnet/csharplang/Type:

Value types differ from reference types in that variables of the value types directly contain their data, whereas variables of the reference types store references to their data, the latter being

Read next

]]>
7930
What are classes and interfaces in C#? https://www.ordisoftware.com/en/blog/2021/09/what-are-classes-and-interfaces-in-c/ Sat, 04 Sep 2021 08:15:02 +0000 https://www.ordisoftware.com/?p=7912

Interfaces are to make an abstraction, an archetype, of the abstraction, the classes, of the reality, the objects.

Interfaces are to specify contract terms without providing implementation provided by classes.

Interfaces are specifications:

Interfaces are design time artifacts to specify the immobile behavior of the concept as it is alone and static. Classes are implementation time artifacts to specify the mobile structure of the reality as it interacts and move. What is an interface?

When we observe a cat we can say that it is an animal that has four paws, a head, a trunk, a tail and

Read next

]]>
7912
What is polymorphism in OOP? https://www.ordisoftware.com/en/blog/2021/09/what-is-polymorphism-in-oop/ Fri, 03 Sep 2021 18:40:30 +0000 https://www.ordisoftware.com/?p=7879

Polymorphism in OOP Theory is the ability to:

Invoke an operation on an instance of a specialized type by only knowing its generalized type while calling the method of the specialized type and not that of the generalized type: this is dynamic polymorphism. Define several methods having the save name but having differents parameters: this is static polymorphism.

The first if the historical definition and the most important.

It allows to create strongly-typed consistency of the class hierarchy and to do some magical things like managing lists of objects of differents types without knowing their types but only

Read next

]]>
7879
What is encapsulation in OOP? https://www.ordisoftware.com/en/blog/2021/09/what-is-encapsulation-in-oop/ Fri, 03 Sep 2021 18:02:47 +0000 https://www.ordisoftware.com/?p=7866

Encapsulation in OOP Theory is the process to mask some properties and operations in the class that will become inaccessible from the exterior: these are only internal things and behaviours like a digestive system.

It's a compartmentalization.

Here is a short and reduced description of what access modifiers do in C#:

Public : fields (variables) and properties (variables encapsulation) and methods (functions and procedures) are visible and accessible by the class itslef, by its childs and by any other external classes. Private : members (fields, properties and methods) are visible and accessible only by the class, not by

Read next

]]>
7866
What is abstraction in OOP? https://www.ordisoftware.com/en/blog/2021/09/what-is-abstraction-in-oop/ Fri, 03 Sep 2021 11:56:06 +0000 https://www.ordisoftware.com/?p=7848

Abstraction in OOP Theory consists in retaining only the relevant aspects of a real world object for a specific problem.

Thus we talk about abstraction of the reality.

It's a reduction.

For example, in the real world we have cats and dogs that are vertebrate animals. Such an animal has properties such as head and legs, and operations like walking and eating. We will then define classes that will be Animal and Cat and Dog.

So we have the concept of inheritance where the cat and the dog inherits properties and operations that are common and that we

Read next

]]>
7848
How to improve your knowledge of C# https://www.ordisoftware.com/en/blog/2021/09/how-to-improve-your-knowledge-of-csharp/ Wed, 01 Sep 2021 13:30:31 +0000 https://www.ordisoftware.com/?p=7772

Study the code of software you like that you can found for example on GitHub, GitLab, SourceForge, etc.

Try to make similar software and adapt them, without plagiarizing outside of personal learning, like a notepad, a calculator, a file explorer, a bank manager... or a game.

Write code, don't stop to write.

And above all, read and re-read books.

Personally, I like Wrox (Wiley) books, they are very good: do not hesitate to read even old books if newer version not available.

Online course are great too, but they don't replace books and source code or professional

Read next

]]>
7772
Are interfaces evil or misused? https://www.ordisoftware.com/en/blog/2009/07/are-interfaces-evil-or-misused/ Sat, 25 Jul 2009 19:30:00 +0000 http://www.xoodbs.net/?p=734 There are several considerations and practices concerning interfaces

Some developers say that interfaces can be used as a replacement of multiple inheritance mechanisms, which cause complexity and ambiguity. But each feature must be implemented each time it is declared: this is not an inheritance, this is a wrapper to the description of a part of a group of classes, like IDisposable. It is the same as a multiple inheritance with one implemented class and some abstract classes: it is a particular case which allows only one way hierarchy with interfaces as abstract connectors that describes services.

Some developers say

Read next

]]>
734
Design flaws of the singleton pattern https://www.ordisoftware.com/en/blog/2009/07/design-flaws-of-the-singleton-pattern-in-csharp/ Tue, 21 Jul 2009 09:00:31 +0000 http://www.xoodbs.net/?p=622 The paradigm

Consider this common singleton pattern implementation:

public class Singleton{ static private readonly object locker = new object(); static public Singleton Instance { get { lock ( locker ) { if ( _Instance == null ) _Instance = new Singleton(); return _Instance; } } } static private volatile Singleton _Instance; private Singleton() { }}

The problem is that you can inherit this class and create a public constructor if there is no private constructor. Furthermore, static members are allowed. This is no longer a singleton at all. Setting the class as sealed can be an acceptable solution, but

Read next

]]>
622