Ambrulz's Wordspace

Menu

Blogroll

Category Archives: VS 2010

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)

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.”

I picked up this trick from one of the msdn blog and I have found it useful on many occasions so I thought that I would share it.

In Visual Studio, go to the Tools menu and click the External Tools menu item. This will bring up the External Tools dialog. The image below shows the information that I have added to add a new menu item called ‘Get SN Public Token’.

The command is the path to sn.exe which can be in different places depending on your VS version. The easiest way to find it is to open a VS Command Prompt and type “where sn.exe”.

The arguments field is set to -T and then the $(TargetPath) variable. The “Use Output Window” option is checked so that the results will be shown in the VS output window. After clicking OK, this will be enabled as a menu item as shown below.

The output for this command will be displayed in the output window. This also works if you have multiple projects in the same solution. Just highlight the project in Solution Explorer and then click the menu item.Happy Coding>;-)

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