Incremental Intellisense Improvements in VS2010
Some improvements like LINQ are substantial, and some just make our lives a little easier. Intellisense in VS2010 has an improvement that is incremental and will make the life of a programmer a little easier.
In VS2008 Intellisense listed members alphabetically by matching characters as you type them. In VS2010 Intellisense lists members using a contains-a approach. Let's take a few minutes to explore this incremental improvement to the VS2010 IDE.
Video buffer memory is still accessible. To see this open a cmd window, run the debug.exe program and send some data right to video memory. (For the demo I am using EGA video memory because I can't recall the CGA video memory addresses.) It is worth noting that odd numbered memory addresses at EGA memory represent the background and foreground RGB colors, and that my typographic errors (shown in Figure 1) show you just how error prone this approach can be (which in turn demonstrates why good debugging tools were and still are so necessary).
Click here for larger image
Figure 1: Entering the raw data right into EGA video memory will display ASCII characters and RGB colors directly to video memory.
Thankfully debugging evolved shortly thereafter with Borland's Turbo Pascal Integrated Development Environment (IDE) and continue to evolve today. Now we have built-in Output windows and Intellisense that make debugging what's going on and figuring out what code base we have to work with substantially easier. (To demonstrate Intellisense for VS2010 I will demonstrate how to redirect IO using .NET in the section "The New and Improved Intellisense".)
Intellisense in Visual Studio 2008
Intellisense in Visual Studio works by displaying members alphabetically. When you type an object name followed by the member of an operator (.) and some alpha-numeric characters Visual Studio will display a drop down window, the first member that start with those characters and then the members that follow alphabetically. Visual Studio 2010 improves on this approach.
The New and Improved Intellisense
When you type an object name, followed by the member of operator in Visual Studio 2010, Visual Studio will display all of the members that start with or contain those characters. Instead of a starts-with, alphabetic listing, Visual Studio 2010 displays a list of members that contain those characters anywhere in the member name, as long as those characters are in the same relative order and the case matches.
To demonstrate, the code in Listing 1 shows you how to
redirect console IO to a WinForm of your choosing, instead
of the IDE's Output window. I will use this code to show you
how Intellisense lists members in VS2010. (Listing 2 shows
you how to add a TextBox to a form and initialize the
MyStreamWriter class with the TextBox,
Console Write and
WriteLine method calls buffering data in the
Listing 1: Building your own debug window in VS2010 using
console IO redirection.
Imports System.Windows.Forms Imports System.Text Public Class MyStreamWriter Inherits System.IO.TextWriter Private control As TextBoxBase Private Builder As StringBuilder Public Sub New(ByVal control As TextBox) Me.control = control AddHandler control.HandleCreated, _ New EventHandler(AddressOf OnHandleCreated) End Sub Public Overrides Sub Write(ByVal ch As Char) Write(ch.ToString()) End Sub Public Overrides Sub Write(ByVal s As String) If (control.IsHandleCreated) Then AppendText(s) Else BufferText(s) End If End Sub Public Overrides Sub WriteLine(ByVal s As String) Write(s + Environment.NewLine) End Sub Private Sub BufferText(ByVal s As String) If (Builder Is Nothing) Then Builder = New StringBuilder() End If Builder.Append(s) End Sub Private Sub AppendText(ByVal s As String) If (Builder Is Nothing = False) Then control.AppendText(Builder.ToString()) Builder = Nothing End If control.AppendText(s) End Sub Private Sub OnHandleCreated(ByVal sender As Object, _ ByVal e As EventArgs) If (Builder Is Nothing = False) Then control.AppendText(Builder.ToString()) Builder = Nothing End If End Sub Public Overrides ReadOnly Property Encoding() As System.Text.Encoding Get Return Encoding.Default End Get End Property End Class
Listing 2: Initialize MyStreamWriter with a TextBox
residing on a form to send Console IO to the TextBox instead
of a command window or the Output window in Visual
Public Class Form2 Private writer As MyStreamWriter = Nothing Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load writer = New MyStreamWriter(TextBox1) Console.SetOut(writer) End Sub End Class
Page 1 of 2