KnowDotNet

New Features in VS2005 and .NET In General

Undiscovered Features in Visual Studio .NET

by Les Smith

If you don't already have a habit of doing so, you should take time to explore new versions of .NET.  Otherwise, you will be missing great short-cuts and time-savers that you probably won't just stumble on.

Sometimes, due to the constant pressure of the present, we fail to take the time to explore things that would make our future work easier and more productive.  Certainly, this is the case with Visual Studio .NET.  When I looked at VB.NET in the first Beta Release, after taking 8 hours to install it, it baffled me and my first thought (I was not the first to think this), "They've broken Visual Basic!"

However, though the years, I have become very appreciative of the time and effort that the Visual Studio team and especially the VB.NET team took to really think through the simple things that would make my life easier and my time more productive as a developer.  The truth of the matter is that I am still discovering big and little things that make my life easier.

This may not seem like a big deal, but in Visual Studio .NET 2003, when you had a reference to a DLL and you changed the original DLL, the reference in the referencing project started showing a little yellow Icon on it, meaning that the Reference had changed.  Since there was no Refresh option on the popup menu on the References object in the Solution Explorer, the only option was to Remove the Reference and re-add it.  
Not so, in VS2005!  When you change the referenced DLL, the Icon still pops up in the referencing project, but a simple left-click of the mouse on the Icon will cause the reference to be automatically refreshed.  Compare that with Remove, Add New Reference, Browse to the Reference, Select and Add.  To me, that's huge!  My thanks to the Visual Studio .NET team!

As to setting aside time for exploring the new namespaces in .NET, especially the ones that you use all of the time, it is false economy on your part not to do it.  In the future, you will save time.  For example, I just discovered this week the String.Join method of the String Class.

If you do as much text file manipulation as I do, numerous times you will have a string array and want to create a delimited string from it.  Not having seen the String.Join before, I always did it the way shown below.  Assuming I have a String array of an unknown length, consider the code below.

   Dim Values() As String
   Const pipe As String = "|"
   Dim s As String = String.Empty
  
For i As Integer = 0 To Values.Length - 1
      
If i < Values.Length - 1 Then
         s &= Values(i) & pipe
      
Else
         s &= Values(i)
      
End If
   Next

Now, assuming that I know about the String.Join method, look at the solution below.  One line does what eight lines did in the previous example.

   Dim s As String = String.Join("|", Values)

Someone has said that, "you are what you eat."  Another said, "You are what you read."  To expand on the latter quote, you will be the kind of developer that you take time to become.

Well, this is probably another of my not earth-shaking articles, but I do hope that it will be thought-provoking.

Ask a Question, or give your feedback on my articles or products by going to the KnowDotNet Forum or by clicking on My Blog.