.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!




Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.


Post New Question Subscribe to Interview Questions
 
Quick Links For Interview Questions Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  OOPs  JQuery  JavaScript/VBScript
BiztalkPatten/PracticesIISWCFWPFWWF
NetworkingAptitudeOthers  All    
 

C# Interview Questions and Answers

what is use of ??

Author: Narayanan          Posted Date: January 16, 2013    Category: C#     Points: 40

This operator allows you to assign a value to a nullable type if the retrieved value is in fact null.

Define Unsafe Keyword

Author: Narayanan          Posted Date: January 16, 2013    Category: C#     Points: 40

In C# the value can be directly referenced to a variable, so there is no need of pointer. Use of pointer sometime crashes the application. But C# supports pointer, that means we can use pointer in C#.The use of pointer in C# is defined as a unsafe code. So if we want to use pointer in C# the pointer must be present in the body of unsafe declaration. But pointer does not come under garbage collection.

Difference between Var vs Dynamic?

Author: Narayanan          Posted Date: January 16, 2013    Category: C#     Points: 40

Var word was introduced with C#3.5(specifically for LINQ) while dynamic is introduced in C#4.0.
Variables declared with var keyword will get compiled and you can have all its related methods by intellisense while variables declared with dynamic keyword will never get compiled. All the exceptions related to dynamic type variables can only be caught at runtime.

Define Anonymous methods

Author: Narayanan          Posted Date: January 16, 2013    Category: C#     Points: 40

Anonymous methods are another way to declare delegates with inline code except named methods.

Define Optional and Named Parameter in C# 4.0

Author: Narayanan          Posted Date: January 16, 2013    Category: C#     Points: 40

Optional parameter allows omitting arguments to function while named parameters allow passing arguments by parameter name.

Difference between Parse vs TryParse?

Author: Narayanan          Posted Date: January 16, 2013    Category: C#     Points: 40

Parse method is used to parse any value to specified data type.
TryParse is a good method if the string you are converting to an integer is not always numeric. The TryParse method returns a boolean to denote whether the conversion has been successfull or not, and returns the converted value through an out parameter.

Difference between String vs StringBuilder?

Author: Narayanan          Posted Date: January 16, 2013    Category: C#     Points: 40

String Class
Once the string object is created, its length and content cannot be modified.
Slower
StringBuilder
Even after object is created, it can be able to modify length and content.
Faster

What is mean by Sealed Class?

Author: Narayanan          Posted Date: January 16, 2013    Category: C#     Points: 40

The sealed modifier is used to prevent derivation from a class. A compile-time error occurs if a sealed class is specified as the base class of another class. (A sealed class cannot also be an abstract class).

Difference between Covariance vs Contravariance:

Author: Narayanan          Posted Date: January 16, 2013    Category: C#     Points: 40

Convariance : Convert from Wider(Double) to Narrow(Float).
Contravariance: Convert from Narrow(Float) to Wider(Double).

Define the Feature s of C# 2.0,C#3.0 and C#4.0

Author: Narayanan          Posted Date: January 16, 2013    Category: C#     Points: 40

C# 2.0-Generics (.NET Framework support was added, and C# benefited from this); iterator pattern (the yield keyword); anonymous methods (the delegate keyword), nullable types, and the null coalescing operator .
C# 3.0-Anonymous types, extension methods, object initializers,collection initializers, implicitly typed local variables (var keyword),lambda expressions (=>), and the LINQ query expression pattern.
C# 4.0-Optional Parameters and Named Arguments, Dynamic typing (dynamic type), improved COM-Interop, and Contra and Co-Variance.




Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend