Banner Ad

Showing posts with label C# Interview Questions. Show all posts
Showing posts with label C# Interview Questions. Show all posts

Thursday, September 3, 2015

Daily Interview Questions #15 : What is the difference between the C# keywords ‘ref’ and ‘out’?

By Francis   Posted at   5:26 AM   C# Interview Questions No comments

ref

out

Parameters passed with the prefix “ref”. By using “ref” C# implements the concept called “Call by reference”. Parameters passed with the prefix “out”.
An argument passed by ref must be assigned with a value before the call. ‘out’ parameter must assigned with some value prior to the termination of the function.

Tuesday, July 8, 2014

Daily Interview Question #12 : What is the purpose of “sealed” keyword in C#?.

By Francis   Posted at   6:31 PM   C# Interview Questions No comments
Sealed
1. When you want to prevent an class from being inherited by another class, you should use “sealed” keyword in front of the class.

Sunday, June 1, 2014

Daily interview Question #10 : what is the purpose of "explicit" implementation of interface?

By Francis   Posted at   7:32 AM   CodeProject No comments

There are 2 purposes of explicit implementation of Interface:
First, it is used to avoid name collision between interface methods. That is if you are going to create a class library, there may be a chance to use the same name in several places. At that time "explicit" implementation comes as a rescue.
Secondly, You cannot access that implemented method through the object of the class directly. Instead you typecast it as Interface reference then you can access it. This is because, the C# complier, unable to determine which one the user want to call.

Tuesday, February 4, 2014

Daily Interview Question #6: What are the different types of Constructor in C#?

By Francis   Posted at   1:03 PM   C# Interview Questions No comments

Below is the list of Constructors available in C#:

1. Default Constructor

2. Parameterized constructor

3. Static Constructor.

 

By default constructor have “public” as access specifier. A class can have more than one Constructor. In C# “this” keyword is used to access the constructor from another constructor. By default, C# will provide a default constructor if no constructor declared.

 

Hope this helps!

Connect with Us