What is serialization?
When transport an object through a network, then we have to convert the object into a stream of bytes. The process of converting an object into a stream of bytes is called Serialization.
Deserialization is the reverse process of creating an object from a stream of bytes.
Deserialization is the reverse process of creating an object from a stream of bytes.
Can we use "this" command within a static method?
We can't use 'This' in a static method because we can only use static variables/methods in a static method.
What is the difference between constants and read-only?
Constant variables are declared and initialized at compile time. The value can't be changed afterward. Read-only is used only when we want to assign the value at run time.
What are sealed classes ?
We create sealed classes when we want to restrict the class to be inherited. Sealed modifier used to prevent derivation from a class. If we forcefully specify a sealed class as base class, then a compile-time error occurs.
What is an object pool in .NET?
An object pool is a container having objects ready to be used. It tracks the object that is currently in use, total number of objects in the pool. This reduces the overhead of creating and re-creating objects.
Object Pooling allows objects to keep in the memory pool so the objects can be reused without recreating them.
Use the Factory pattern for this purpose. which will take care of the creation of objects.If there is any object available within the allowed limit, it will return the object, otherwise, a new object will be created and give you back.
What are delegates in C# and the uses of delegates?
Is an abstraction of one or more function pointers
You can treat a function as data.
It allow functions to be passed as parameters.
Why Do We Need Delegates?
Callback is to handle button-clicking.
is a solution for situations in which you want to pass methods around to other methods.
You do not know at compile time what this second method is. That information is available only at runtime, hence Delegates are the device to overcome such complications.
What is a Virtual Method in C#?
A virtual method is a method that can be redefined in derived classes. A virtual method has an implementation in a base class as well as derived the class.
The overriding method also provides more than one form for a method. Hence, it is also an example of polymorphism.