Indexers
An indexer allows an object to be indexed such as an array. When you define an indexer for a class, this class behaves similar to a virtual array. You can then access the instance of this class using…
An indexer allows an object to be indexed such as an array. When you define an indexer for a class, this class behaves similar to a virtual array. You can then access the instance of this class using…
It’s possible to write code for years without deliberately using delegate, Action, or Func types. I say “deliberately” because we may have used them without realizing it. Knowing what these types represent makes reading code easier. Knowing how to…
Dispose Garbage collector (GC) plays the main and important role in .NET for memory management so programmer can focus on the application functionality. Garbage collector is responsible for releasing the memory (objects) that is not…
Exception handling in C#, suppoted by the try catch and finaly block is a mechanism to detect and handle run-time errors in code. The .NET framework provides built-in classes for common exceptions. The exceptions are…
Data abstraction is the process of hiding certain details and showing only essential information to the user.Abstraction can be achieved with either abstract classes or interfaces (which you will learn more about in the next chapter). The abstract keyword is used for classes…
Extension methods enable you to “add” methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are static methods, but they’re called as if they were…
Structs In C#, a structure is a value type data type. It helps you to make a single variable hold related data of various data types. The struct keyword is used for creating a structure. Structures are…
C# virtual method is a method that can be redefined in derived classes. In C#, a virtual method has an implementation in a base class as well as derived the class. It is used when a…
What Is an Interface? First and foremost, interfaces in C# are a means to get around the lack of multiple inheritances in C#, meaning you cannot inherit from multiple classes but you can implement multiple…