Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

The Baker's Dozen: 13 Reasons to Upgrade to Visual Studio 2005 : Page 2

Visual Studio 2005 offers new capabilities in many different areas, such as data access, language enhancements, IDE productivity features, deployment, Office integration, XML, and many others!


advertisement
Reason 2: Language Enhancements in Visual C# 2.0
Visual C# 2.0 offers some impressive language enhancements. Here are a few of my favorites in no specific order of importance: Generics: While C# is a strongly-typed language, there are times when a developer needs to create a generic object and later cast it to a specific type. A commonly-documented example is collections, where a developer can store references to any type of object and then perform a cast to retrieve the actual value of an index within the collection. Unfortunately, the developer surrenders the element of compile-time type safety, and this casting incurs a small performance penalty because of the boxing and unboxing that occurs.

New Namespace: Visual Studio 2005 provides a new namespace, Systems.Generic.Collections. This namespace allows a developer to create a generic collection and specify the permitted member types; consequently, the compiler will only permit the developer to add objects of the types previously declared. The developer no longer needs to perform cast operations to retrieve a value from a collection. Anonymous Methods: These methods simplify the code required to implement event handlers. A developer can include code for an entire handler method in-line instead of instantiating a delegate and writing a method to which it points.

Partial Classes. You can use partial classes to define a class in more than one source file (using the new partial keyword). A common situation is a partial form class, where part of the class represents the Winform designer-generated code and the other part represents the developer's code. Also, in a multi-developer environment, developers can work on different parts of the same class, and IntelliSense will display all members, properties, and methods from all parts. In a sense, Visual Studio merges all of the code from the different parts into one class. Of course, you cannot duplicate property and method names in any of the parts. Partial classes open up new opportunities in several areas such as code generation projects. However, like any new capability, you should use partial classes judiciously. In some instances, a single class that is large enough to be logically divided among several developers might be a candidate for multiple classes. Additionally, a team should create meaningful naming conventions for each source file part.



In addition, Visual C# 2.0 supports generic iterators, static classes, and nullable types. Suggested reading:

  • Three Cool New Features in C# by Markus Egger (CoDe Magazine, January 2004)
  • The C# Version 2.0 Specification from Microsoft
  • Jesse Liberty has several excellent articles on www.ondotnet.com
  • A Sneak Preview of Visual C# Whidbey (MSDN)
  • Refactoring C# Code Using Visual Studio 2005 (MSDN)
Reason 3: 'My' Language Enhancements in Visual Basic 2005
Anyone with even basic knowledge of .NET knows that the .NET Framework has a large number of namespaces, classes, properties, etc. Many developers have commented that becoming proficient with the framework is the most difficult part of the learning curve—some even comment about the amount of time it takes just to learn and use the major namespaces. In recognition of the learning curve, Microsoft has created a My hierarchy to improve access to commonly-used framework classes and assist new Visual Basic programmers in quickly performing common development tasks. The My hierarchy is divided into several categories. For example, one category is Computer for system information which is further broken down into subcategories like FileSystem and Printers.

Some of the C# enhancements described above (partial classes, generics) are also available in Visual Basic 2005. Additionally, Visual Basic 2005 now supports XML comments, a feature previously available to C# developers. This allows VB developers to insert comments that IntelliSense will use. Finally, Visual Basic 2005 supports a new in-line Using statement to instantiate an object and execute code, and then immediately release it (to avoid memory leaks). Suggested reading:

  • Language Enhancements in Visual Basic 2005 by Stan Schultes (MSDN)
  • A Sneak Preview of Visual Basic 2005 by Ken Getz (MSDN)
  • Oh My!! - A Look at the My Namespace in Visual Basic 2005 by Keith Franklin (CoDe Magazine, September 2004)
Reason 4: New Controls and Capabilities in Windows Forms
Microsoft has added new capabilities to Windows Forms that many Windows Forms developers will appreciate. Masked Textbox: In Visual Studio .NET 2003, developers who wanted to use a data entry input mask either had to write their own or search for a third-party control. Visual Studio 2005 has a new MaskTextBox control. You can chose from several pre-defined masks such as Zip Code, SSN, Phone Number (with or without area code), Date, and Time. Alternatively, you can define custom input masks.

Visual Studio 2005 also provides new ToolStrip, StatusStrip, MenuStrip, and ContextMenuStrip controls (replacing the ToolBar, StatusBar, MainMenu, and ContextMenu controls). These provide a look and feel consistent with Microsoft Office System 2003. Developers who want to create split windows can use the new SplitContainer control. Also, developers who instantiate data-bound controls on the fly (data-driven entry forms) and have to write complex code to cleanly align controls are in luck: the new FlowLayoutPanel and TableLayoutPanel controls contain a FlowDirection property to help control relative positioning of dynamically instantiated controls.

Many new developers found databinding in Visual Studio .NET 2003 to be daunting: Microsoft has made improvements to databinding through new capabilities such as the BindingSource and BindingNavigator components. Experienced developers who wrote custom code for binding solutions in Visual Studio .NET 2003 may elect to retain their investment, but newer developers will likely find Visual Studio 2005's binding capabilities more to their liking. They can use binding with all data-bound controls, especially the new GridView control (which replaces the DataGrid control). Finally, developers can implement Auto-complete functionality with the new textbox and combobox controls using the new AutoCompleteMode and AutoCompleteSource properties and, (optionally), the new AutoCompleteCustomSource collection.

Suggested reading:

  • What's New in the Visual Studio 2005 Toolbox for Windows Applications, by Dino Esposito (CoDe Magazine, January 2005)
  • Brian Noyes presented sessions at the MSDN CodeCamp in Philadelphia on data binding in 2005. Go to www.phillydotnet.org/codecamp and search the Sessions page.
  • Exploring New WinForm Controls in Visual Studio Whidbey by Michael Lane Thomas (CoDe Magazine, January 2004).


Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap