Welcome to MSDN Blogs Sign in | Join | Help

After a discussion about ReSharper with yet another colleague the other day, I decided that it was finally time I installed the trial and gave it a go.  After all, it's only on version 4 already :)

I've un-installed it after only a day or so, I won't go into that right now, but during the time I had it installed it kept prompting me to change the way I declared variables.  Every time I declared a variable like this

string myValue = "Hello";

I would get a prompt suggesting I replaced the declaration with

var myValue = "Hello";

This prompt appeared for any local variable declarations, but I find myself questioning whether this is good coding practice or not.  I understand the benefits of the var keyword and in certain scenarios, such as when using LINQ or anything else that uses anonymous types, it is an extremely powerful tool to have at your disposal.  However, in plain old coding, surely you want to be explicit about what you are declaring?  The two expressions may well get compiled down to the same code, but in a world where code readability and maintainability rank highly on the priority list then I personally like being able to see at a glance what types I'm dealing with.

Just my 2p...

While investigating ways to control parameterised web servers in Visual Studio web tests yesterday I found out that you can use environment variables to set the values of context parameters within your test.  If you have a context parameter called, for example, 'WebServer1' (original I know), then you can use an environment variable called 'Test.WebServer1' to pass a value in to the test.  This is of course not limited to web server names and can be used where appropriate for any other environment specific context values by specifying an environment variable of the format 'Test.ContextParameterName'.

This problem can also be addressed using data binding or test plug-ins, depending on your requirements.

The use of environment variables for this scenario is mentioned in a note on the following MSDN page.

 

0 Comments
Filed under: ,

Ok, so it's not exactly an original title for a first post on a technical blog, but I felt it had to be done...

You can find out a little about me and what I do here.  My aim for this blog is to provide useful technical information based on the work I do at Microsoft and the challenges and problems that I see customers facing. 

I can't promise to be the most frequent poster, but hopefully someone will benefit from what I post on here :)

 

0 Comments
Filed under:
 
Page view tracker