Prev | Current Page 40 | Next

Guy Fouch?©, Trey Nash

"Accelerated VB 2008"

Length > 4 Then
ValidTicker = False
End If
Return ValidTicker
End Function
Extension methods avoid the need to create a separate class, with a shared method, to
validate the ticker symbol.
Anonymous Types
Using anonymous types, you are able to declare, define, and use types that the VB compiler
will generate for you in the background. Anonymous types are able to infer field names and
will create properties for these fields as well. This example shows an anonymous type declared
in VB:
Dim anAnonymous = New With {.FirstName = "Jodi", .LastName = "Fouche"}
IntelliSense Everywhere
When using extension methods and anonymous types, you will find that the VB IDE is aware
of these types and methods. As such, it includes your extension methods with the extended
type??™s methods in all IntelliSense lists while coding. Anonymous types will show their compilergenerated
properties in IntelliSense lists while coding.
Nullable Types, Enhanced in VB 2008
Nullable type syntax is enhanced in VB 2008. A new type modifier (?) allows you to define your
types as nullable. The following code snippet demonstrates the current syntax and the new
shortcut.
Dim x As Nullable(Of Integer)
Dim y As Nullable(Of Integer)
Dim x As Integer?
Dim y As Integer?
CHAPTER 1 n VB 2008 OVERVIEW 9
Relaxed Delegates, Enhanced in VB 2008
Relaxed delegates extend and enhance the VB??™s implicit conversions to delegate types.


Pages:
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
katalog stron London Escort Agencies Okulary dieta light pensjonaty w beskidach