Finally, we looked at some of the new features that are now a part of VB, including LINQ,
object and array initializers, extension methods, anonymous types, and Option Infer.
In the next chapter, we??™ll dive into VB syntax, explore VB namespaces, and discuss control
flow.
CHAPTER 1 n VB 2008 OVERVIEW 10
VB 2008 Syntax
This chapter is an introduction to the syntax of the Visual Basic (VB) language. The topics
covered here are the glue that binds programs together. We??™ll take a close look at types and
variables, as the common type system (CTS) is a key component of the .NET common language
runtime (CLR).
We??™ll also look at namespaces: a .NET concept you??™ll put into practice as soon as you write
your first program. Understanding namespaces not only helps you navigate VB classes and
other types to find the features you need, but it also helps you to organize your own types in a
logical manner. We??™ll wrap up with an overview of VB control flow statements, which may differ
in syntax from other languages but are the same in concept.
Types and Variables
Types in VB can be either value types or reference types. Value types, such as structures and
built-in types, live in memory reserved by your application: the stack. When your program
executes a method, it places (pushes) all declared variables onto the stack.
Pages:
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54