Home
C-Sharp
Interview FAQs

Show

FAQs of level

If we want one delegate to point to multiple methods / function we use multicast delegates.

Delegate declaration determines the methods that can be referenced by the delegate. A delegate can refer to a method, which has the same signature as that of the delegate.

For example, consider a delegate:

public delegate int MyDelegate (string s);


The preceding delegate can be used to reference any method that has a single string parameter and returns an int type variable.

Syntax for delegate declaration is:

delegate <return type> <delegate-name> <parameter list>

Dispose: This method uses interface – “IDisposable” interface and it will free up both managed and unmanaged codes like – database connection, files etc.
Finalize: This method is called internally unlike Dispose method which is called explicitly. It is called by garbage collector and can’t be called from the code.


The built-in libraries are organized within namespaces. Namespaces organize objects in an assembly. An assembly is a reusable, version able and self-describing building block of a CLR application. Assemblies can contain multiple namespaces. Namespaces can contain other namespaces. We can add namespaces in our application used the “using” keyword. Example-

using System;

using System.Collections.Generic;


Destructors’ are used to destruct instances of classes. When we are using destructors in C#, we have to keep in mind the following things:

  1. A class can only have one destructor.
  2. Destructors cannot be inherited or overloaded.
  3. Destructors cannot be called. They are invoked automatically.
  4. A destructor does not take modifiers or have parameters.


Boxing is used to convert value types to object.
E.g. int x = 1;
object obj = x ;
Unboxing is used to convert the object back to the value type.
E.g. int y = (int)obj;
Boxing/unboxing is quiet an expensive operation.


JIT is a compiler that converts MSIL to native code. The native code consists of hardware specific instructions that can be executed by the CPU. Rather than converting the entire MSIL file to native code, the JIT converts the MSIL as it is needed during execution. This converted native code is stored so that it is accessible for subsequent calls.

Invalidate the current form, the OS will take care of repainting. The Update method forces the repaint.
PreviousDisplaying 18 of 25Next
Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*