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

C# Constructor

In C#, a constructor is the member of the class and is automatically invoked once the object of the class is created. It is like a method in a program and is used for the initialization of the data members of a newly created object. Two types of C# constructors Default constructor Parameterized constructor Default Constructor … Read more

C# Object and Class

C# is an object-oriented programming language and classes and objects are the fundamental components of OOP’s. Everything in C# is built upon classes and objects. Let us learn classes and objects with an example. C# Class A class is a user-defined blueprint or prototype for creating Objects. We can say that it is a template for … Read more

C# Array Class

There are various operations that can be done with an array such as creating, manipulating, sorting, searching, etc. This is done by the array class that provides various methods to perform mentioned operation in C#. Note: In C#, Array is not part of the collection but considered as a collection because it is based on … Read more

C# Params Array

Sometimes a situation may arise where you do not know how many parameters you want to pass to a method or you may want the method to accept n number of parameters at runtime. In such times params type array can solve the problem. param is a keyword in C# that creates an array at … Read more

C# Passing Array to Function

In this tutorial, we will learn how to pass an array to function in C#. Before that you need to have an idea on following topics in C#. Function in C# C# Arrays We use a function to reuse a block of code in a program. And we can pass an array to the function … Read more