Close

c# – Create a read-only property (aka a constant)

So far we have looked at 5 ways to store data in a class’s object (aka an instance) in the form of “properties”. Of which one of the recommended ways of setting values to properties, is by using the constructor method, e.g.: [csharp] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Employee […]

Read More

c# – Instantiate an object and set it’s Properties simultaneously (using the Constructors approach)

2nd Approach – Using the “Constructor” Constructor is a special type of method that is present in all classes, even if you don’t explicitly define it in the class itself. Constructors are used for creating an instance of the object…. this basically means that whenever you declare a new instance of a class, e.g.: Employee […]

Read More

c# – Instantiate an object and set it’s Properties simultaneously (using the Initialization approach)

  1st Approach: Using Initialization Here we use properties (as demonstrated in the previous), but this time we set all the properties in one go, by writing them as part of the object’s actual declaration, using curly-bracket syntax: [csharp] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Employee { public string Firstname […]

Read More

c# – Hello World

Here we are going to first show you a simple “hello world” program in the form of an exe file. When you double-click on the exe file, all that will happen is that a console terminal will open a display the message “hello world”, like this:   Step 1 -Write the code Open notepad and […]

Read More

c# – Introduction

C# is a powerfull object oriented program language. It is heavily engineered programming language. In this tutorials you are going to learn all kinds of things. In our tutorials we will show you a lot of things that won’t make a lot of things until much later. That’s why we will show you a lot […]

Read More