nn Object-oriented development has been expanded to be fully supported in Visual Basic .NET. This includes full inheritance, parameterized con- structors, and control over property and method overriding. nn Variables can be declared and initialized on the same line. Previously, variables were first declared (associated with a data type) and later initialized to a value. Additionally, the variant data type is no longer supported. However, the user still is not required to declare variables before initializing them. For example, the following ASP.NET Page di- rective can be used to turn off option explicit, thus suspending the need to declare variables before using them. Generally, this is a poor pro- gramming practice and is not encouraged. <%@Page Language = vb Explicit=false %> nn Type Safety is used to generate errors when a data type conversion could fail at runtime. nn Error handling has been expanded to support the C-based language Try...Catch...Finally exception-handling statements. Visual Basic previ- ously required, and still accepts, On Error statements in each proce- dure, which often results in duplicated code. The Try...Catch...Finally statements represent a more structured error-handling process that per- mits the nesting, and consequently the reuse, of exception-handling rou- tines. Additionally, the Finally statement is a control structure for writing cleanup code that executes in both normal and exception conditions. nn Initializers can be used anywhere, including inside a control structure. Visual Basic .NET supports initializing the variable on the same line on which it is created. The semantics for a procedure-level declaration is similar if written in a single line as opposed to a declaration statement followed by an assignment statement. In other words, the following two examples are equivalent. Dim Y As Integer = 10 Dim Y As Integer Y = 10 nn Parentheses must be used in calling functions and subprocedures. All methods, functions, and subprocedures must now use parentheses to close the parameter list. nn Parameters are now passed to functions and subprocedures by value by default. Earlier versions of Visual Basic defaulted to passing parameters by reference. The ByRef keyword can still be used to pass a parameter by reference. nn New conversion methods are available for converting data types. Although older methods such as CStr are available, newer methods such as ToString are recommended. Introduction to the .NET Framework 13 04235946 Ch01.F 12/11/02 11:43 AM Page 13