Windows Phone Developers

Sunday, April 27, 2008

Use of aliases in .NET (Imports Statement)

Imports Statement (.NET Namespace and Type) – Use of aliases

Use of aliases can save your precious time.

Imports Microsoft.Office.Interop.Excel

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim oXL As Microsoft.Office.Interop.Excel.Application

oXL = New Microsoft.Office.Interop.Excel.Application

can be changed to

Imports Excel = Microsoft.Office.Interop.Excel

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim oXL As Excel.Application

oXL = New Excel.Application

Saves a lot of typing and more concise.

Import aliases are useful when you need to use items with the same name that are declared in one or more namespaces. Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment

kbAlertz.com :: Visual Studio 2005

kbAlertz.com :: Visual Studio 2008

kbAlertz.com :: Visual Basic 2005