C#4.0 Dynamic Vs Var keyword

In C# 4.0 we have a new keyword called dynamic, I can use it as with any types like int, float,double, string

after reading above line, we all have question “What’s new in that?, I can also do this with Var keyword.” the answer is “Yes”, We can still do the same thing with Var keyword,but it has a different behavior, Let me explain you with the example

when you declare a variable with Var keyword, var are  implicitly but statically typed, let me explain the meaning of that.

when you write like below compiler figured out that someString must be of type string (i.e. from initialize) and then it will use reflection to get all information about the type at the compile time.(See below pic)

Var someString = "Some String Example";

Similarly when you use dynamic keyword instead of var, it will behave differently, it will behave most similar to object.

With dynamic, properties / methods / operators / etc are resolved at runtime, based on the actual object

According to the MSDN blog “Variables declared with var are implicitly but statically typed. Variables declared with dynamic are dynamically typed. This capability was added to the CLR in order to support dynamiclanguages like Ruby and Python.”


Microsoft C# Default Key bindings which I generally use.

Hi Readers,
Here is the list of some keyboard short cuts which I generally use in my daily development tasks, you can download the Full Poster from the Microsoft site. Here is the Download Link

1. Ctrl + . (Implement the interface methods)
2. Ctrl + – (Navigate backward)
3. Ctrl + Shift + – (Navigate forward)
4. F7 (View code)
5. Shift + F7 (View designer or mark ups)
6. Ctrl + G (Go to the line number)
7. Ctrl +F4 (close the current tab)
8. F9 (Insert the breakpoint at the current line)
9. Ctrl + F9 (Disable the break point from the current line).
10. Ctrl + Shift +B (Build the solution)
11. Ctrl + Break (Break the build in between).
12. F3 (Find next)
13. Shift +F3 (Find Previous).
14. F5 (Run the application with hitting the breakpoint).
15. Ctrl + F5 (Run the application without hitting the breakpoint Or Skipping the breakpoint).
16. F12 (go to definition).
17. Ctrl + K + C (Comment out the current line).
18. Ctrl + K + U (Uncomment the current line).
19. Ctrl + K +D (Format document).
20. Ctrl + K + F (Format selected area).
21. Ctrl + K + S (Surround the area with the code snippet).
22. Ctrl + K + X (Surround the area with the code snippet with asking language).
23. Tab 2 times (Invoke snippets from the shortcuts).

Download the file, print it and fix it to your box’s wall. Give it a chance and then you tell me.
PS: Did you already know the Ctrl+Point keybinding? Okay, I am pretty sure you will find many unknown key combinations in the poster

Important Asp.Net web sites