Interview Tips Interview Tips, Interview Questions and Answers

25Feb/100

C# interview questions with answers

How can you check a nullable variable is assigned?
using hasvalue method

what is the syntax of a nullable variable?
Nullable myval=null;

I would like to check a variable as assigned or not. How can we do that?
Declare the variable as Nullable

What are the different compiler generated methods when a .NET delegate is compiled?
Compilation of a .NET delegate results in a sealed class with three compiler generated methods whose parameters and return values are dependent on the delegate declaration. The methods are,
Invoke()
BeginInvoke() and
EndInvoke().

When TimerCallback delegate is used?
Many application have the need to call a specific method during regular intervals. For such situations we can use the System.Threading.Timer type in conjunction with a related delegate named TimerCallback.

Which enumeration defines different PenCap in C#?
LineCap enumeration which defines different pen cap styles as follows,

public enum LineCap
{
Flat, Square, Round, Triangle, NoAncher, SquareAnchor,
RoundAnchor, DiamondAnchor, ArrowAnchor, AnchorMask, Custom
}

What is the use of param keyword in C#?
In C# param parameter allows us to create a method that may be sent to a set of identically typed arguments as a single logical parameter.