C# File I/O

Files are used to store the data permanently in the storage device with a specific name and path. And when we open the file in order to read or write, it becomes a stream. File Handling refers to the various operation that can be performed on a file such as reading from a file, writing … Read more

C# throw keyword

We have already discussed the exception handling in C# and how to handle the exception if one exists. The exception discussed are raised by the CLR automatically, now we will see how we can manually raise an exception. In C#, we use the keyword ‘throw’ in order to throw an exception programmatically. We can raise … Read more

C# Exception Handling

An exception is an event that occurs during the execution of the program i.e. during run–time. This event is unexpected, not known by the program, and disrupts the normal flow of the code. So to handle such errors, we create an exception handler code which will be executed when it finds an exception in a … Read more

C# Strings

In C#, String is the series of characters or array of characters that represents a text. It is of a reference type (Object) in c#. Various operations are performed on a string such as concatenation, comparison, getting substring, search, trim, replacement, etc. It is a reference type. It’s immutable that is its state cannot be … Read more

C# Inheritance and its Types

Inheritance is an important pillar for the foundation of Object-Oriented Programming (OOP). It is a process in C# through which one class can acquire the fields and methods of another class. Inheritance allows us to inherit or acquire the features of the parent class to the child class so that we can be reuse, extend … Read more

C# Operator Overloading

We have learned that the method can be overloaded in C#, in the same way, we can also overload the operator. We can perform the various operations with the same operator in C#. Operator overloading means performing different operations with the same operator. We can overload most of the built-in operators that are provided by … Read more

C# Method Overriding

Method overriding is done through inheritance, it allows us to define a method at a derived class with the same name present in a base class with the same signature and same return type then the method in a base class is said to be overridden. In method overriding, the base class method uses virtual … Read more

C# Method Overloading

A method is said to be overloaded if two or more methods having the same name but different parameters. The difference could be in a number of parameters or types of parameters so that compiler can tell the difference. The advantage of method overloading is that you don’t have to use different names for the … Read more

C# Polymorphism

Polymorphism means having many forms. The word “poly” means many and “morphs” means form. Polymorphism is one of the core principles of object-oriented programming which means it is the way of performing some task in many ways. With polymorphism, a class can have multiple implementations with the same name. There are two types of polymorphism … Read more

C# Properties

C# properties are the class members that provide a flexible way for the class to expose its private field. It provides a way to read, write, and perform some computation to the private fields of the class. These properties have special methods called accessors that are used to set, get, and compute on private fields … Read more