C# String

String can be defined as an array of characters. In C#, string is an object of System.String which represents sequence of characters. Strings can be concatenated, comparison, getting substring and many more. In C#, using String and string doesn’t make any difference. both are the same except that the thing that String is a class …

Read moreC# String

C# Encapsulation

Encapsulation is a mechanism in which we wrap the data into a single unit called class. By Encapsulation, Data alteration is not possible through unknown sources. The data can only be accessed through getter methods. Encapsulation increases the maintenance of the code which enhances usability. We can access the class data by the getter and …

Read moreC# Encapsulation

C# Access Modifiers

C# provides various keywords to control or restrict accessibility or scope of the data. We can apply access modifiers to functions and variables. There are five access modifiers in C#: Private Protected Internal Protected internal Public Let’s see each one of them in detail: Access Modifier Description public Public variable is accessible everywhere Protected Protected …

Read moreC# Access Modifiers

C# Namespace

C# Provides Concept of namespacing to organize your classes in a good manner. It makes the application easy to handle. It is like packaging of java. The System is a namespace which is used in merely every Console application. It provides methods for writing and reading from console. We can use ‘using’ keyword to avoid …

Read moreC# Namespace

C# Interface

Interface can be defined as a blueprint of the class. It can only have abstract methods. It has to be implemented by a class or struct. It is mainly used to achieve full abstraction because it can’t have normal methods. In C#, multiple inheritance is achieved by interface. Interface can’t be instantiated. If a class …

Read moreC# Interface

C# Abstraction

Abstraction is a mechanism by which we can hide the complexities and show only functionalities. C# provides an abstract keyword to declare a class and method as abstract. In C#, Abstraction is achieved by two ways: By abstract class By Interface Abstract class and interface both can have abstract methods which are necessary to achieve …

Read moreC# Abstraction

C# Sealed

C# provides sealed keyword to apply restrictions on class and methods. If a class is defined as sealed then it can’t be inherited. If a method is defined as sealed then it can’t be overridden. This is like final keyword of java. The main advantage of sealed class is that the third party vendor can’t …

Read moreC# Sealed

C# Polymorphism

Polymorphism is the combination of two words, poly+forms which means many forms. It is a greek word . In C#, Polymorphism is achieved by mixing three mechanisms that are Inheritance, encapsulation and polymorphism. There are two types of polymorphism named as compile time polymorphism and run time polymorphism. Compile time polymorphism is achieved by method …

Read moreC# Polymorphism

C# Base

C# provides a base keyword to access base class properties in the chilled class. C# Base is almost similar to the super in java. It can only be used inside instance methods and constructors. It can’t be used inside any static method like main. C# Base class example: accessing parent’s class fields


Read moreC# Base