Amazon.co.uk Review
While there's a short overview of the VB.NET language and the VB.NET Framework included VB.NET Language in a Nutshell isn't intended as a guide for beginners, though it will prove useful as a reference alongside one of the many VB.NET tutorials currently in the works.
The heart of the book is the alphabetical listing of VB.NET's statements, procedures, functions and objects. These detail the syntax, the arguments accepted, the data type returned by functions and keyword differences from VB 6. Better yet, and in keeping with O'Reilly's high standards, rather than just rewrite Microsoft's technical notes the authors have tried them out, provided cross references to related keywords, details on usage and even point out any gotchas they've discovered along the way. The code examples demonstrating just how to employ many of the functions, methods and so on in your own code are especially welcome, especially where these differ from their usage under VB 6, though as always, you'll wish there were more.
Overall, a great early entrant into what will soon become a crowded market for VB.NET titles--and one you won't regret buying whatever else becomes available. This is highly recommended. --Steve Patient --This text refers to an out of print or unavailable edition of this title.
Martin Heller, Byte.com June 2002
Dan Mabbut, About.com Visual Basic Guide, Dec 2002
Product Description
With the release of the Microsoft .NET platform comes a new version of Visual Basic dramatically unlike its predecessors. So extensive are the changes, in fact, that some VB programmers argue that Visual Basic .NET is an entirely new programming language. In the updated second edition of this popular book, you will find complete documentation for the Visual Basic .NET language.
Beginning with a brief overview of the language, VB.NET Language in a Nutshell covers basic programming concepts, and introduces the .NET Framework Class Library and programming with attributes. The bulk of the book consists of an alphabetical reference to Visual Basic .NET statements, procedures, functions, and objects. Each entry has a standardized listing containing the following information:
- Its syntax, using standard coding conventions
Differences in the operation of the keyword in Visual Basic .NET and in VB 6.0 A list of arguments accepted by the function or procedure A description of the data type returned by a function The finer points of a language element?s usage that are often omitted from or blurred over by other sources Tips and warnings that include undocumented behaviors and practical applications for particular language elements An invaluable section for diagnosing or avoiding potential programming problems A cross-reference to related keywords
On the CD-ROM (included with print edition of the book) is a plug-in that adds a copy of the book's language reference to the dynamic help within Visual Studio .NET. The plug-in requires any edition of Visual Basic .NET or Visual Studio .NET.
No matter how much experience you have programming with VB, you want this book close by, both as a standard reference guide and as a tool for troubleshooting and identifying programming problems.
From the Publisher
As a quick introduction, the first section of VB .NET Language in a Nutshell leads you through the important areas of programming VB .NET, including:
Variables and Data Types Introduction to Object Oriented Programming
The .NET Framework: General Concepts
The .NET Framework Class Library
Delegates and Events
Error Handling
The meat of the book is the alphabetical reference to the functions, statements, directives, objects, and object members that make up the VB .NET language. As an experienced developer, you can quickly get the whole story on a language element that interests you or seems to be behaving unexpectedly in your code. To ease your transition to .NET, there's a "VB .NET/VB 6 Differences" section for each language element.
A hefty appendix section includes:
What's New and Different in VB .NET Language Elements by category
Operators
Constants and Enumerations
The VB .NET Command Line Compiler
VB 6 Language Elements Not Supported by VB .NET
No matter how much experience you have programming with VB, this is the kind of book you'll want to have close by, both as your standard reference guide and as a tool for troubleshooting and identifying programming problems.
--This text refers to an out of print or unavailable edition of this title.
About the Author
Excerpted from VB.NET Language in a Nutshell by Steven Roman, Ron Petrusha. Copyright © 2002. Reprinted by permission. All rights reserved.
Attributes are declarative tags that can be used to annotate types or class members, thereby modifying their meaning or customizing their behavior. This descriptive information provided by the attribute is stored as metadata in a .NET assembly and can be extracted either at design time or at runtime using reflection.
To see how attributes might be used, consider the attribute, which might appear in code as follows:
_
Public Function PageHitCount(strULR As String) As Integer
Ordinarily, public methods of a class can be invoked locally from an instance of that class; they are not treated as members of a web service. In contrast, the attribute marks a method as a function callable over the Internet as part of a web service. This attribute also includes a single property, Description, which provides the text that will appear in the page describing the web service.
You may wonder why attributes are used on the .NET platform and why they are not simply implemented as language elements. The answer comes from the fact that attributes are stored as metadata in an assembly, rather than as part of its executable code. As an item of metadata, the attribute describes the program element to which it applies and is available through reflection both at design time (if a graphical environment such as Visual Studio .NET is used), at compile time (when the compiler can use it to modify, customize, or extend the compiler's basic operation), and at runtime (when it can be used by the Common Language Runtime or by other executable code to modify the code's ordinary runtime behavior).
The behavior of interface objects (i.e., controls) in Visual Studio .NET illustrates the importance of attributes. Since Visual Studio offers drag-and-drop placement of controls on forms or web pages, it is necessary for controls to have a design time behavior in addition to their runtime behavior. For instance, when you double click on a control in a designer, you ordinarily want the code or the code template for its default event handler to be displayed. Note that the question posed here is not how the control should respond to a double-click event, since the DoubleClick event occurs at runtime and, if an event handler is present, causes that event handler's executable code to be executed. Because we're concerned with the standard behavior of a control in its design time environment, an attribute provides an excellent solution. Indeed, the .NET Framework provides the attribute, which allows you to define a control's default event. Since information on the attribute is stored in the assembly's metadata, Visual Studio can simply look to see whether a attribute is attached to a particular control when it is double-clicked in a designer window.
The attribute-based system of programming implemented in .NET is extensible. In addition to the attributes predefined by Visual Basic or by the .NET Framework, you can define custom attributes that you apply to program elements. For an attribute to be meaningful, there must also be code that attempts to detect the presence of the attribute at design time, at compile time, or at runtime, and accordingly that performs an action dictated by the attribute's presence.
This chapter discusses the syntax and use of attributes, and then shows how to define and use custom attributes.
Syntax and Use
In Visual Basic, an attribute appears within angle brackets (a less-than ()). The attribute name is followed by parentheses, which are used to enclose arguments that might be passed to the attribute. For example, the attribute marks a type or type member as obsolete. We can apply as a parameter-less attribute as follows:
If no arguments are assigned to the attribute, we can omit the trailing parentheses:
If more than one attribute is applied to a single program element, the attributes are enclosed in a single set of angle brackets and delimited from one another by a comma. For example:
Public Function PageCount( _
strURL As String) As Integer
Each attribute corresponds to a class derived from System.Attribute. (In fact, the VB.NET compiler actually treats an attribute as an instance of the attribute's class.) By convention, we drop the trailing string "Attribute" from the class name to form the attribute name, although the attribute name can also be identical to the class name. Thus, for example, the attribute corresponds to the WebMethodAttribute class in the System.Web.Services namespace, which in turn is found in System.Web.Services.dll. Alternately, you can also specify the attribute as . If the namespace containing the attribute class is not automatically accessible to the Visual Basic compiler or to Visual Studio, the Imports directive should be used, and a reference should be added to the project either using the References dialog in Visual Studio or the /r switch in the command-line compiler.
TIP: If the shortened attribute name is a Visual Basic .NET keyword, use an attribute name that's identical to the attribute's class name to prevent a compiler error. For example, the following declaration produces an error because ParamArray is a VB.NET keyword:
lScores As Long)
NOTE: However, the following code compiles correctly:
lScores As Long)
The attribute class constructor or constructors determine whether any arguments are required. For example, the attribute corresponds to the VBFixedStringAttribute class, which has the following constructor:
New(ByVal Size As Integer)
Hence, the attribute can be used as follows:
Private sID As String
TIP: Attribute constructors can be overloaded. Any required arguments must correspond to those expected by one of the constructors in number and data type.