Home
|
Tutorial
|
Articles
|
Forum
|
Interview Question
|
Code Snippets
|
News
|
Fun Zone
|
Poll
|
Web Links
|
Certification
|
Search
Welcome :
Guest
Sign In
Register
Win Surprise Gifts!!!
Congratulations!!!
Top 5 Contributors of the Month
Jean Paul
satyapriyanayak
Narayanan
Karthikeyan Anbarasan
JQuery Developer
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.Net
Windows Application
.NET Framework
C#
VB.Net
ADO.Net
Sql Server
SharePoint
Silverlight
OOPs
JQuery
JavaScript/VBScript
Biztalk
Patten/Practices
IIS
WCF
WPF
WWF
Networking
Aptitude
Others
All
C# Interview Questions and Answers
How the Dynamic works .net 4.0?
Author:
senthilstayss
Posted Date: March 13, 2013 Category:
C#
Points: 40
We are going to see how the Dynamics work in .Net now. For example consider the following statement.
dynamic d=GetSomeData(15); When we execute this statement,Let's see what will happen behind the scenes.
When the above statement executes, the DLR will pass the expression trees to the target object.If the dynamic data type is pointing in memory to a COM object, then the expression tree will be sent to the COM interface named IDispatch. This interface is COM's way of incorporating its own set of dynamic services.
If the dynamic data is not pointing to a COM object, then the expression tree may be passed to the object implementing the IDynamicObject interface.This interface is used to map the expression tree to Ruby specifics in the dynamic languages like Iron Ruby.
If suppose the dynamic data is not pointing to COM object and does not implement IDynamicObject, then the object will be considered as .Net object. In this case the expression tree is sent to the C# run time binder for processing.
After the expression tree has been processed by the given binder, the dynamic data will be resolved to the real in-memory data type after which the correct method is called with any necessary parameters.
To know more about the expression tree basics , please read the following article.
http://www.codeproject.com/Articles/235860/Expression-Tree-Basics
Check this blog for more info about var and dynamic:-
senthilvijayalakshmi.blogspot.in/2013/03/difference-between-var-and-dynamic.html
difference between Var and Dynamic keyword in c#
Author:
senthilstayss
Posted Date: March 08, 2013 Category:
C#
Points: 40
The Var(Implicit typed local variable) keyword is used to define local variables.In case of Var , the underlying data type is determined at compile time itself based on the initial assignment.Once the initial assignment has been made with Var type , then it will become strongly typed.If you try to store any incompatible value with the Var type it will result in compile time error.
But in Dynamic type, the underlying type is determined only at run time.Dynamic data type is not checked at compile time and also it is not strongly typed.We can assign any initial value for dynamic type and then it can be reassigned to any new value during its life time.
Example:
dynamic test="Senthil";
Console.Writeline(test.GetType()) // System.String
test=1222;
Console.Writeline(test.GetType()) // System.Int32
test=new List<string>();
Console.Writeline(test.GetType()) //System.Collections.Generic.List'1[System.String]
It doesn't provide IntelliSense support also.It doesn't give better support when we give work with linq also.Because it doesn't support lambda expressions ,extension methods and anonymous methods.
Check this blog for more info about var and dynamic:-
senthilvijayalakshmi.blogspot.in/2013/03/difference-between-var-and-dynamic.html
What does Dispose method do with the connection object?
Author:
Narayanan
Posted Date: February 28, 2013 Category:
C#
Points: 40
Deletes it from the memory.
What are the ways to deploy an assembly?
Author:
Narayanan
Posted Date: February 28, 2013 Category:
C#
Points: 40
An MSI installer, a CAB archive, and XCOPY command.
What is a New modifier?
Author:
Narayanan
Posted Date: February 28, 2013 Category:
C#
Points: 40
The new modifier hides a member of the base class. C# supports only hide by signature.
What is Static Method?
Author:
Narayanan
Posted Date: February 28, 2013 Category:
C#
Points: 40
It is possible to declare a method as Static provided that they don't attempt to access any instance data or other instance methods.
Does C# support a variable number of arguments?
Author:
Narayanan
Posted Date: February 28, 2013 Category:
C#
Points: 40
Yes, using the params keyword.
Can you have parameters for static constructors?
Author:
Narayanan
Posted Date: February 28, 2013 Category:
C#
Points: 40
No
What is the difference between CONST and READONLY?
Author:
Narayanan
Posted Date: February 28, 2013 Category:
C#
Points: 40
Both are meant for constant values. A const field can only be initialized at the declaration of the field. A readonly field can be initialized either at the declaration or.
Can you override private virtual methods?
Author:
Narayanan
Posted Date: February 28, 2013 Category:
C#
Points: 40
No, private methods are not accessible outside the class.
« Previous
1
2
3
4
5
6
7
8
9
10
….
45
46
Next »
Hall of Fame
Twitter
Terms of Service
Privacy Policy
Contact Us
Archives
Tell A Friend