Returning Data and Using Method Results .. .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. .. 78
Method Snippets .............................................................. 80
Coding Fields and Properties ........................................................ 81
Declaring and Using Fields ................................................... 81
Declaring and Using Properties ............................................... 83
The Property Snippet ......................................................... 86
Summary ........................................................................... 87
4 Learning Just Enough C# and VB.NET: Intermediate Syntax .. .. . .. .. . . 89
Understanding Delegates and Events ................................................ 90
Events ........................................................................ 91
Delegates ..................................................................... 94
Event, Delegate, and Handler Code Completion ... .. . .. .. . .. .. . .. .. . .. .. . .. .. . 95
Implementing Interfaces ............................................................ 96
Creating an Interface .......................................................... 97
Making Classes Implement the Interface .. .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . . 98
Writing Code That Uses an Interface .......................................... 101
The interface Snippet ......................................................... 106
Applying Arrays and Generics ...................................................... 107
Coding Arrays ................................................................ 107
Coding Generics .............................................................. 109
Summary ........................................................................... 110
PART II Learning the VS 2010 Environment
5 Creating and Building Projects ........................................... 113
Constructing Solutions and Projects ................................................. 114
Creating a New Project ....................................................... 115
Navigating the Solution Explorer ............................................. 116
Examining Property Settings ........................................................ 118
Assembly Name .............................................................. 119
Default Namespace ........................................................... 119
Target Framework ............................................................ 119
Output Type .................................................................. 119
Startup Object ................................................................ 120
Icon and Manifest ............................................................ 120
Assembly Information ........................................................ 121
Referencing Assemblies ............................................................ 122
Adding a .NET Assembly Reference .......................................... 123
Managing Assembly References .............................................. 124
Referencing Your Own Class Libraries .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . 125
Using Code in Class Libraries ................................................ 126
Contents xi