Archives for C# - Page 7
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…
Object Oriented Programming
Object Oriented Programming (OOP) involves defining classes and creating objects that resemble real life objects. For example, consider a car. The car has properties such as color, speed, model, manufacturer and…
Structures
structures or structs are user-defined data types that can contain other variables as its fields and methods as its behavior. You can create your very own customized data type using structures. Let…
Converting Enumerations
You can converting enumerations to other values and vice versa. Enumeration values are actually numeric values that are just masked by their names so that they can easily be understood.…
Enumeration
Enumeration is a way of defining your own type that can accept a predefined set of values identified by names. For example, you want a variable that can only store directions…
Command Line Arguments
To successfully run a C# application, you must provide a Main method. The Main() method is the starting point of the program. It is declared public or internal, and it must also be static. You can actually…