C# Namespace

Namespace in C# is used in a program to organize the code separately from each other. Classes are maintained with namespace to organize in a better way. With the use of namespace, we can keep one set of names different from another set of names. The vital importance of namespace is that it prevents the … Read more

C# Interface

An Interface is the same as a class, it is a blueprint of a class. Just like any other class, an interface can have methods, properties, events, and indexers as its members. But unlike a class, the method in it is an abstract method (only method signature, contain no body). Interface is used to achieve abstraction and multiple … Read more

C# Abstraction

Abstraction in object-oriented programming is a way to hide the details and only displaying the relevant information to the users. It is a technique through which we can separate the interface with the implementation details. Abstraction and encapsulation are the related feature in C#. Abstraction is used to hide the implementation detail while encapsulation is … Read more

C# Access Modifiers/Specifiers

Access modifiers or specifiers in C# define the accessibility of the member, class, or datatype in a program. These are the keyword that restricts unwanted manipulation of data in a program by other classes. There are five types of access specifiers in C#. Public Protected Internal Protected internal Private Let us go through each of … Read more

C# Encapsulation

Encapsulation is an important concept of Object-oriented programming. Encapsulation is the concept of wrapping up data(variable) under a single unit. It binds data members and member functions inside a class together. Encapsulation prevents accessing the implementation details, it makes sure that the ‘sensitive’ data are hidden from the user which leads to the important concept … Read more

C# Enum

Enum is also known as enumeration that consists of a set of named integral constants. In C#, enumerations are value data types. The keyword enum is used to define these data types. The is mainly used to assign the names or string that makes the code more maintainable and readable. For example, we can create … Read more

C# Struct

Struct in C# is a value type and a collection of variables of different data types inside a single unit. It is similar to classes in C# because both are the blueprints to create an object of a class and both are user-defined types. However, a struct is a value type whereas a class is … Read more

C# Static Keyword

Static is a keyword in C# that is when used with different to declare static classes and static class members. Static can be field, method, constructor, class, properties, operator, and event. The instance of a class is not required in order to access static members. There is only one copy of the object is created … Read more

C# this Keyword

In C#, this is a keyword that refers to the current instance of a class. It is also used to pass the object to another method as a parameter and also used to call a constructor of another class from the same class in a program. It is used to access members from the constructors, … Read more

C# Destructor

A destructor is the opposite of a constructor. A destructor destroys the object of a class as soon as the scope of an object ends. It is also invoked automatically just like a constructor. The destructor cannot have parameters nor modifiers. Syntax of destructor in C# The destructor has the exact same name as the … Read more