Ans :

"Throw" statement preserves original error stack whereas "throw ex" have the stack trace from their throw point. It is always advised to use "throw" because it provides more accurate error information.

 

Ans :

"is" operator is used to check the compatibility of an object with a given type and it returns the result as Boolean.

"as" operator is used for casting of object to a type or a class.

 

 

Ans :

Value types can take either their normal values or a null value. Such types are called nullable types.

Int? UserID = null;
If(UserID.HasVAlue)
{
}

 

 

Ans :

Structs are value-type variables and classes are reference types. Structs stored on the stack, causes additional overhead but faster retrieval. Structs cannot be inherited.

 

 

Ans :

In C# Methods can be overloaded using different data types for parameter, different order of parameters, and different number of parameters.

 

Ans :

In C# method overriding, we change the method definition in the derived class that changes the method behavior. Method overloading is creating a method with the same name within the same class having different signatures.

 

Ans :

In C# Dispose() is called when we want for an object to release any unmanaged resources with them. On the other hand Finalize() is used for the same purpose but it doesn't assure the garbage collection of an object.

 

Ans :

In C# Interfaces have all the methods having only declaration but no definition. In an abstract class, we can have some concrete methods. In an interface class, all the methods are public. An abstract class may have private methods.

 

Ans :

In C# Protected Internal variables/methods are accessible within the same assembly and also from the classes that are derived from this parent class.

 

Ans :

In C# an array, we can have items of the same type only. The size of the array is fixed. An arraylist is similar to an array but it doesn't have a fixed size.

 
Page 1 of 0