Class Libraries
You can create a Class Libraries which is a collection of classes and other codes that can be compiled and redistributed for software reusability. Class libraries are compiled into dynamic link…
Structures Versus Classes
So what’s the difference between a class and a structure? Structures are value types like int, double, and string. When you copy a value of structures to other variables, it copies its values…
Namespaces
Using a namespace is a way of packaging your application codes such as classes into a uniquely named structure. Everything in .NET Framework is wrap inside at least one namespace. When…
Properties
Properties are the C# standard for accessing private data members inside a class. They may behave like normal fields, but properties have getters which gets the value of the private data and setters which sets a value…
Encapsulation
Encapsulation or information hiding is the process of hiding the sensitive data of an object from a user and only providing him/her with what is necessary. When we define a class,…
Access Specifiers
Access specifiers determine the accessibility of a class method or data members. We’ll take a look at the public and private access specifiers. The public access specifier is used when you want to access a method or…
readonly Fields
The readonly keyword is used for fields that will not allow modification of ;readonly fields have similar characteristics as constants except that you can allow a readonly field to have no value from…
Destructors
Destructors are the opposite of constructors. Destructors are also special methods that are called when the object is being destroyed. Objects use the memory of your computer and if they are not removed…
Constructors
Constructors are special methods that are required to create or “construct” objects. They allow you to assign the initial values for each data member of an array and add codes that…
Defining a Class
A C# class let’s you define a user-defined data type that contains fields, properties, and methods. A class serves as a blueprint for an object. The object is the actual thing that follows the…