Archives for C# - Page 6
Boxing and Unboxing
Boxing is the process of converting a value type such as a structure into an object or a reference ;Unboxing is the opposite the opposite process and converts reference types to value…
System.Object Class
All classes in the .NET Framework inherits from the ;class. The ;class is mapped to the object keyword in C#. For simplicity, I will just use object to refer to The following is a list of…
Virtual Methods
Virtual methods are methods of a base class that can be overridden by a method in a derived class to provide a different implementation of that method. For example, you have…
Static Members
The static keyword is used on members and properties that want to be shared by all instance of the class. When a method or property is defined as static, you can call them…
protected Access Specifier
The protected access specifier allows class members to be accessed only by those who inherits from them. We learned about the public and private access specifiers. The protected access specifier is used when only the derived classes and…
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,…