Should You Use Existing Visual Basic Syntax or the New .NET Equivalents?

Visual Basic .NET includes many language features of earlier versions for which corresponding functionality exists in the .NET Framework. This includes major areas such as file IO, for which there is a completely new model available in the Framework, and minor items such as the MsgBox statement, which has an almost exact counterpart in the Framework method MessageBox.Show(). For each of these cases, where the same functionality exists in both the “native” Visual Basic commands and in the Framework, you have to decide which one you are going to use.

As you read this book, we will attempt to guide your decision by showing you which of the options we use in each code sample. For most of the areas where there is a choice, it is essentially a personal preference, but in some cases one or the other is better and we will let you know why that is. You may hear the opinion expressed that you should not use any feature that is Visual Basic specific, but we feel that is a definite mistake. The language-specific features are what makes Visual Basic unique and you should use them whenever they work for you. It is also worth noting there are many features of Visual Basic .NET that are not included in the .NET Framework. For example, Visual Basic's conversion functions (CInt, CStr, CDec, and so on) do a lot more than the Int32.Parse routine supplied by the Framework, and IsNumeric is a powerful function that many C# programmers would love to use (and they can, if they reference the Microsoft.VisualBasic.dll from their projects).

Take advantage of all of the functionality your language of choice offers; if you are programming in Visual Basic, program the Visual Basic way.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.27.29