Datasheet

20
CHAPTER 1 VISUAL STUDIO 2010
set it equal to another object, and the AS Integer portion of your declaration isn t required, it is inferred as
part of the assignment operation. Be careful with Option Infer; if abused it can make your code obscure, since
it reduces readability by potentially hiding the true type associated with a variable. Some developers prefer to
limit Option Infer to per fi le declarations to limit its use to when it is needed, for example with LINQ.
How to use Option Infer in LINQ is covered in Chapter 10.
In addition, note that Option Infer is directly affected by Option Strict. In an ideal world, Option Strict
Off would require that Option Infer also be turned off or disabled in the user interface. That isn t the case,
although it is the behavior that is seen; once Option Strict is off, Option Infer is essentially ignored.
Below the grid of individual settings in Figure 1 - 7 is a series of check boxes. Two of these are self - explanatory
and; the third is the option to generate XML comments for your assembly. These comments are generated
based on the XML comments that you enter for each of the classes, methods, and properties in your source fi le.
Visual Basic Express has fewer check boxes, but users do have access to the Advanced Compile Options
button. This button opens the Advanced Compiler Settings dialog shown in Figure 1 - 8. Note a couple of
key elements on this screen, the fi rst being the Remove integer over ow checks check box. When these
options are enabled, the result is a performance hit on Visual Basic applications in comparison to C#.
The compilation constants are values you shouldn t need to touch normally. Similarly, the generation of
serialization assemblies is something that is probably best left in auto mode.
FIGURE 1 - 8
However, the last item on the screen enables you to target different environments. If you select a version prior to
version 4, then, when you begin to add references, the Add References tab recognizes which version of .NET you
are targeting and adjusts the list of available references to exclude those that are part of version 4 similarly
excluding 4, 3.5, and 3.0 if you are targeting .NET 2.0.
CH001.indd 20CH001.indd 20 4/5/10 11:56:31 AM4/5/10 11:56:31 AM