TAILIEUCHUNG - Professional ASP.NET 1.0 Special Edition- P43
Professional Special Edition- P43:Those of us who are Microsoft developers can't help but notice that .NET has received a fair amount of visibility over the last year or so. This is quite surprising considering that for most of this period, .NET has been in its early infancy and beta versions. I can't remember any unreleased product that has caused this much interest among developers. And that's really an important point, because ignoring all the hype and press, .NET really is a product for developers, providing a great foundation for building all types of applications | Hello there This has its biggest impact when switching between the ASP and environments. Method Arguments By default arguments to methods in Visual Basic .NET are now passed by value rather than by reference. This means the following code will not work as expected Sub Foo X As Integer X X 1 End Sub Dim Y As Integer 3 Foo Y Y The output here will be 3 rather than 4. To correct this you need to change the procedure declaration to Sub Foo ByRef X As Integer Default Properties The use of default properties is not allowed in Visual Basic .NET. This doesn t affect .NET components since there s no way to define a default property but it has an impact when accessing COM objects. For example the following would not be allowed Dim rs As New Dim Name As String . . Name rs Name The last line in .NET would be Name rs Name .Value While this does mean more typing it makes the code much more explicit and therefore less prone to potential errors. Set and Let The Set and Let keywords are no longer required for object references. For example the following is now the accepted syntax Dim conn As SQLConnection conn SQLConnection There s no need for the Set keyword before the object assignment. Single and Multiple Lines In Visual Basic .NET all If statements must be constructed across multiple lines. For example in VBScript you could do this If x y Then foo In Visual Basic .NET this becomes If x y Then foo End If JScript .NET JScript .NET remains much closer to its pre- .NET version. As far as programmers are concerned the most obvious difference is in data types. Variables can now be declared using the following syntax var variableName DataType value For example var Name String var Age Integer 24 Functions also have the addition of data types function foo Boolean return True Implicit Type Conversion Data types can be implicitly converted using the following syntax TypeName expression For example var d .
đang nạp các trang xem trước