MCSD Certification Toolkit (Exam 70-483) - it-college.org

scatteredneedlessSoftware and s/w Development

Nov 2, 2013 (3 years and 7 months ago)

1,993 views

MCSD CERTIFICATION TOOLKIT
(EXAM 70-483)
INTRODUCTION

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
xxvii
Ch
A
p
TER
1

Introducing the Programming C# Certification

. . . . . . . . . . . . . . . . . . . . . .
.
1
Ch
A
p
TER
2

Basic Program Structure

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
19
Ch
A
p
TER
3

Working with the Type System

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
Ch
A
p
TER
4

Using Types

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
113
Ch
A
p
TER
5

Creating and Implementing Class Hierarchies

. . . . . . . . . . . . . . . . . . . .
.
161
Ch
A
p
TER
6

Working with Delegates, Events, and Exceptions

. . . . . . . . . . . . . . . .
.
207
Ch
A
p
TER
7

Multithreading and Asynchronous Processing

. . . . . . . . . . . . . . . . . . .
.
265
Ch
A
p
TER
8

Creating and Using Types with Reflection, Custom Attributes,
the CodeDOM, and Lambda Expressions

. . . . . . . . . . . . . . . . . . . . . . . .
319
Ch
A
p
TER
9

Working with Data

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
361
Ch
A
p
TER
10

Working with Language Integrated Query (LINQ)

. . . . . . . . . . . . . . . . .
431
Ch
A
p
TER
11

Input Validation, Debugging, and Instrumentation

. . . . . . . . . . . . . . .
.
469
Ch
A
p
TER
12

Using Encryption and Managing Assemblies

. . . . . . . . . . . . . . . . . . . .
.
527
A
pp
ENDIX


Answers to Sample Test Questions

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
571
INDEX

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
587
D
ownload from Wow! eBook <www.wowebook.com>
MCSD Certification Toolkit (Exam 70-483)
MCSD Certification Toolkit (Exam 70-483):
PROGRAMMING IN C#
Tiberiu Covaci
Gerry O’Brien
Rod Stephens
Vince Varallo
MCSD Certification Toolkit (Exam 70-483): Programming in C#
Published by
John Wiley & Sons, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2013 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 9781118612095
ISBN: 978-1-118-61206-4 (ebk)
ISBN: 978-1-118-72950-2 (ebk)
ISBN: 978-1-118-72929-8 (ebk)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108
of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers,
MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the
Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-
6008, or online at
http://www.wiley.com/go/permissions
.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with
respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including
without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or pro-
motional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold
with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services.
If professional assistance is required, the services of a competent professional person should be sought. Neither the pub-
lisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to
in this work as a citation and/or a potential source of further information does not mean that the author or the publisher
endorses the information the organization or Web site may provide or recommendations it may make. Further, readers
should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was
written and when it is read.
For general information on our other products and services please contact our Customer Care Department within the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with
standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to
media such as a CD or DVD that is not included in the version you purchased, you may download this material at
http://booksupport.wiley.com
. For more information about Wiley products, visit
www.wiley.com
.
Library of Congress Control Number: 2013933931
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trade-
marks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries,
and may not be used without written permission. All other trademarks are the property of their respective owners. John
Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book.
To Lia for her patience and understanding during the
writing process. All my love.
—Gerry O’Brien
For Maki.
—Rod Stephens
To Renee, Madison, and Courtney.
—Vince Varallo
ABOUT T
h
E AUT
h
ORS
TIBERIU COVACI

is an Independent trainer and mentor teaching C# and .NET in general, and
ASP.NET and parallel computing in particular. He works closely with Microsoft Learning helping
them develop new courses, conducting beta classes and doing technology reviews for the upcoming
courses. He was part of the Microsoft Certified Trainer Advisory Council between 2010 and 2012.
Tiberiu is a popular speaker at industry conferences and user groups around the world. His sessions
and workshops get good reviews from both the attendees and the organizers.
Tiberiu is a Microsoft Certified Trainer and holds almost all .NET certification from .NET 2.0 and
forward. He is as well an IASA certified trainer, an ASP.NET Insider, and a Telerik Insider. He is an
INETA Speaker Bureau member and IASA Speaker. For his dedication and passion, Microsoft and
Telerik presented Tibi with the MVP Award.
Tiberiu is the husband of lovely Nicoleta and the proud father of Anna and Disa.
GERRY O’BRIEN

currently works at Microsoft as a program manager in Microsoft Learning where
he manages internal tools and platforms working with teams of developers and testers. Prior to the
program manager role, Gerry worked as the Certification Product Planner for the developer and
SQL Server audiences at Microsoft Learning. In that role, he planned the exam portfolio for these
audiences, working with industry experts to define the exam content and manage the exam from
envisioning through development, beta, and release. Prior to working at Microsoft, Gerry worked as
a software development consultant and trainer.
ROD STE
ph
ENS

started out as a mathematician, but, while studying at MIT, discovered how much
fun programming is and has been programming professionally ever since. During his career, he has
worked on an eclectic assortment of applications in such fields as telephone switching, billing, repair
dispatching, tax processing, wastewater treatment, concert ticket sales, cartography, and training
for professional football players.
Rod is a Microsoft Visual Basic Most Valuable Professional (MVP) and has taught introductory
programming at ITT Technical Institute. He has written more than two dozen books that have been
translated into languages from all over the world, and more than 250 magazine articles covering
Visual Basic, C#, Visual Basic for Applications, Delphi, and Java.
Rod’s popular VB Helper website (
www.vb-helper.com
) receives several million hits per month and
contains thousands of pages of tips, tricks, and example programs for Visual Basic programmers, as
well as example code for this book. His C# Helper website (
www.csharphelper.com
) contains simi-
lar material for C# programmers.
You can contact Rod at
RodStephens@csharphelper.com
or
RodStephens@vb-helper.com
.
VINCE VARALLO

has been developing applications using Microsoft technologies for the past 17
years. He began his career as a Visual Basic 3 developer and has worked with VB 4, 5, and 6 until
the .NET Framework 1.0 was released. He was an early adopter of ASP.NET and C#, and has con-
centrated on line-of-business applications throughout his entire career. He is currently the director
of Technology Solutions at a digital marketing agency where he works with a wide variety of tech-
nologies. He previously authored ASP.NET 3.5 Enterprise Application Development with Visual
Studio 2008 and contributed as an author for Professional Visual Basic 6: The 2003 Programmer’s
Resource.
ABOUT T
h
E TEC
h
NICAL EDITOR
ANDERS BRATLAND

combines his two passions, programming and teaching other people how to
program, by working as a freelance consultant, which gives him the chance to work both as a
Microsoft Certified Trainer and as a developer.
Anders is a well-known speaker at conferences like TechDays, Scandinavian Developer Conference,
and Developer Summit. Anders is also active as speaker in different user groups, such as
DotnetForum, and also as one of the organizers in the largest Swedish user group, Swenug.
Anders has a strong commitment to techniques and methods that can help projects to be successful,
especially by adopting agile values and disciplines.
Anders is a Microsoft ASP.NET MVP and a member of the Swedish Microsoft Extended Expert
Team, MEET.
CREDITS
EXECUTIVE EDITOR

Robert Elliott
p
ROJECT EDITOR

Jennifer Lynn
TEC
h
NICAL EDITOR

Anders Bratland
p
RODUCTION EDITOR

Daniel Scribner
CO
p
Y EDITOR

San Dee Phillips
EDITORIAL MANAGER

Mary Beth Wakefield
FREELANCER EDITORIAL MANAGER

Rosemarie Graham
ASSOCIATE DIRECTOR OF MARKETING

David Mayhew
MARKETING MANAGER

Ashley Zurcher
BUSINESS MANAGER

Amy Knies
p
RODUCTION MANAGER

Tim Tate
VICE
p
RESIDENT AND EXECUTIVE GROU
p

p
UBLIS
h
ER

Richard Swadley
VICE
p
RESIDENT AND EXECUTIVE
p
UBLIS
h
ER

Neil Edde
ASSOCIATE
p
UBLIS
h
ER

Jim Minatel
p
ROJECT COORDINATOR, COVER

Katie Crocker
COM
p
OSITOR

Jeff Lytle, Happenstance Type-O-Rama
p
ROOFREADER

James Saturnio, Word One
INDEXER

Ron Strauss
COVER DESIGNER

Wiley
COVER IMAGE

iStockphoto/microstocker
ACKNOWLEDGMENTS
I would like to thank my lovely wife Nicoleta and my daughters, Anna and Disa, for supporting me
and putting up with me for the past three years. I know this was a long process, and I know you
might have not liked it at times, but now that is done I hope that people will find it educational and
then all of it was worth it.
I want to thank Bob Elliott for believing in me even when I didn’t. I want to thank Jennifer Lynn
and Rosemarie Graham for their help in making this book happen. I would like to thank Anders
Bratland for lending his expertise and making sure that this book is technologically accurate. I
would like to thank my co-authors Gerry O’Brien, Rod Stephens, and Vince Varallo for their hard
work and devotion.
I would also like to thank Sergiu Damian for his help reviewing my chapters, Catalin Pop for
helping me with his expertise on encryption, and Susan Ibach and Christopher Harrison for
recommending me as author.
Last but not least I would like to thank my parents for making me who I am.
—Tiberiu Covaci
CONTENTS
INTRODUCTION

xxvii
C
h
A
p
TER 1:
INTRODUCING T
h
E
p
ROGRAMMING C# CERTIFICATION

1
Getting Certified

1
Why Get Certified?

2
What Is MS Certification?

4
Certification Changes

5
The Initial Certifications (Version One)

5
A New Generation of Certifications (Version 2)

6
The Current Microsoft Certifications (Version 3)

6
Other Microsoft Certifications: The MTA

7
Things to Know About the Test

8
How the Test Is Created

8
How Questions Are Written

9
How to Study for the Exam Using This Book

11
Prep Guide

11
Functional Groups

11
Practice Questions

12
Preparation

12
The 70-483 Objectives

12
Manage Program Flow (25 Percent)

12
Implement Multithreading and Asynchronous Processing

13
Manage Multithreading

13
Implement Program Flow

13
Create and Implement Events and Callbacks

13
Implement Exception Handling

13
Create and Use Types (24 Percent)

13
Create Types

13
Consume Types

14
Enforce Encapsulation

14
Create and Implement a Class Hierarchy

14
Find, Execute, and Create Types at Runtime Using Reflection

14
Manage the Object Life Cycle

14
Manipulate Strings

14
Debug Applications and Implement Security (25 Percent)

14
Validate Application Input

15
Perform Symmetric and Asymmetric Encryption

15
Manage Assemblies

15
xviii
Debug an Application

15
Implement Diagnostics in an Application

15
Implement Data Access (26 Percent)

15
Perform I/O Operations

15
Consume Data

16
Query and Manipulate Data and Objects by Using LINQ

16
Serialize and Deserialize Data

16
Store Data in and Retrieve Data from Collections

16
Summary

16
Additional Reading and Resources

17
C
h
A
p
TER 2:
BASIC
p
ROGRAM STRUCTURE

19
Writing Your First Program

20
Exploring the Structure of the Program

21
Understanding Simple Statements

21
Understanding Complex Statements

23
Controlling Program Flow

24
Conditional Instructions

25
Boolean Expressions

28
Making Decisions in Code

29
if Statements

30
Beyond Basic if Statements

35
switch statements

36
Using Loops

38
for statements

39
Nested for Loops

42
foreach statements

43
while statements

45
do-while statements

46
Summary

51
Test Questions

51
Additional Reading and Resources

53
Cheat Sheet

54
Review of Key Terms

56
C
h
A
p
TER 3:
WORKING WIT
h
T
h
E TY
p
E SYSTEM

59
Creating Value Types

61
Understanding Predefined Value Types

61
Working with Data Structures

66
Working with Enumerations

72
Creating Reference Types

76
Understanding Modifiers

77
xix
Defining Fields

79
Using Constructors

81
Defining Methods

82
Overloaded Methods

88
Abstract and Overridden Methods

90
Extension Methods

92
Optional and Named Parameters

94
Understanding Encapsulation

95
Properties

96
Enforced Encapsulation by Using Properties

97
Indexed Properties

101
Understanding Generic Types and Generic Methods

102
Defining Generic Types

103
Using Generic Types

103
Defining Generic Methods

103
Using Generic Methods

104
Summary

105
Chapter Test Questions

106
Additional Reading and Resources

108
Cheat Sheet

109
Review of Key Terms

111
C
h
A
p
TER 4:
USING TY
p
ES

113
Converting Between Types

114
Using Widening and Narrowing Conversions

114
Using Implicit and Explicit Conversions

116
Casting

117
The is Operator

118
The as Operator

118
Casting Arrays

119
Converting Values

122
Parsing Methods

122
System
.
Convert

127
System
.
BitConverter

128
Boxing and Unboxing Value Types

128
Ensuring Interoperability with Unmanaged Code

130
Handling Dynamic Types

133
Manipulating Strings

137
Behind the Strings

138
String Constructors

138
String Fields and Properties

139
String Methods

140
xx
Additional String Classes

144
StringBuilder

145
StringWriter

147
StringReader

147
Formatting Values

149
ToString

150
String
.
Format

150
Formatting Strings

151
Summary

153
Test Questions

154
Additional Reading and Resources

156
Cheat Sheet

157
Review of Key Terms

158
C
h
A
p
TER 5:
CREATING AND IM
p
LEMENTING CLASS
h
IERARC
h
IES

161
Inheriting from a Base Class

162
Calling Parent Class Constructors

164
Calling Same Class Constructors

165
Designing and Implementing Interfaces

171
Defining Interfaces

173
Implementing Interfaces

174
Delegating Interfaces

175
Implementing Common Interfaces

176
IComparable

177
IComparer

179
IEquatable

182
ICloneable

183
IEnumerable

185
Managing Object Life Cycle

190
Implementing the IDisposable Interface

190
Providing Destructors

191
Using the using Statement

197
Summary

199
Test Questions

199
Additional Reading and Resources

202
Cheat Sheet

203
Review of Key Terms

205
C
h
A
p
TER 6:
WORKING WIT
h
DELEGATES,

EVENTS, AND EXCE
p
TIONS

207
Working with Delegates

208
Delegates

208
xxi
Delegate Details

211
Static and Instance Methods

212
Covariance and Contravariance

214
Built-in Delegate Types

215
Action Delegates

216
Func Delegates

216
Anonymous Methods

217
Lambda Expressions

218
Expression Lambdas

218
Statement Lambdas

221
Async Lambdas

222
Working with Events

223
Publishing Events

224
Predefined Event Types

225
Event Best Practices

225
Event Inheritance

227
Subscribing and Unsubscribing to Events

230
Using Code to Subscribe to an Event

230
Using Designer to Subscribe to an Event

231
Exception Handling

234
Error Checking and Exception Handling

234
try-catch-finally Blocks

235
Unhandled Exceptions

238
Common Exception Types

240
SQL Exceptions

242
Overflow Exceptions

244
Exception Properties

246
Throwing and Rethrowing Exceptions

248
Using Exceptions and Return Values

248
Catching, Throwing, and Rethrowing Exceptions

249
Creating Custom Exceptions

251
Making Assertions

252
Summary

253
Chapter Test Questions

253
Additional Reading and Resources

258
Cheat Sheet

259
Review of Key Terms

262
C
h
A
p
TER 7:
MULTIT
h
READING AND

ASYNC
h
RONOUS
p
ROCESSING

265
Creating Responsive Applications

266
Working with Threads

267
xxii
Spawning New Threads by Using ThreadPool

273
Unblocking the UI

276
BackgroundWorker Class

276
Multithreaded Windows Forms Applications

279
Multithreaded WPF Applications

280
Working with the Task Parallel Library

281
Introducing Task

282
Creating Tasks

284
Working with the Scheduler

288
Using the Parallel Class

288
Working with Continuations

291
Programming Asynchronous Applications with C# 5
.
0

293
Exploring Advanced Multithreading
Programming Topics

297
Synchronizing Resources

298
Synchronization Events

298
Barriers

302
Using Locking Mechanisms

304
Monitors

305
Lock-Free Alternatives

306
Working with Concurrent Collections

308
Working with Cancellations

309
Summary

311
Chapter Test Questions

312
Additional Reading and Resources

314
Cheat Sheet

315
Review of Key Terms

316
C
h
A
p
TER 8:
CREATING AND USING TY
p
ES

WIT
h
REFLECTION, CUSTOM ATTRIBUTES,

T
h
E CODEDOM, AND LAMBDA EX
p
RESSIONS

319
Using the System.Reflection Namespace

320
Assembly Class

321
The System
.
Type Class

325
GetArrayRank

328
GetConstructors

328
GetEnumName, GetEnumNames, and GetEnumValues

329
GetField and GetFields

330
GetProperty and GetProperties

332
GetMethod and GetMethods

332
Read and Create Custom Attributes

335
Read Attributes

335
Create Attributes

337
xxiii
Generate Code Using the CodeDOM Namespace

340
CodeCompileUnit

344
CodeNamespace and CodeNamespaceImport

344
CodeTypeDeclaration

345
CodeMemberField

345
CodeMemberProperty

345
CodeMemberMethod

347
CodeParameterDeclarationExpression
and CodeMethodInvokeExpression

348
CodeDOMProvider

348
Lambda Expressions

349
Delegates

349
Anonymous Methods

351
Lambda Expressions

351
Summary

352
Chapter Test Questions

353
Additional Reading and Resources

357
Cheat Sheet

358
Review of Key Terms

359
C
h
A
p
TER 9:
WORKING WIT
h
DATA

361
Working with Data Collections

362
Arrays

362
Collections

365
System
.
Collections

365
System
.
Collections
.
Generic

371
Custom Collections

374
Consuming Data

377
Working with ADO
.
NET

377
Connection

377
Command

379
DataSet, DataTable, and DataAdapter

384
Working with the ADO
.
NET Entity Framework

388
Create an Entity Framework Model

388
Select Records

391
Insert Records

392
Update Records

393
Delete Records

393
Call a Stored Procedure

393
Creating WCF Data Services

394
Create a WCF Data Service

395
D
ownload from Wow! eBook <www.wowebook.com>
xxiv
Create a Client Application That Uses WCF Data Services

400
Request Data as JSON in a Client Application

403
Performing I/O Operations

404
Files and Directories

405
Streams

408
Readers and Writers

410
Asynchronous I/O Operations

414
Understanding Serialization

416
Binary Serialization

416
XML Serialization

417
JSON Serialization

418
Custom Serialization

419
Summary

421
Chapter Test Questions

422
Additional Reading and Resources

427
Cheat Sheet

428
Review of Key Terms

429
C
h
A
p
TER 10:
WORKING WIT
h


LANGUAGE INTEGRATED QUERY (LINQ)

431
Understanding Query Expressions

432
Filtering

434
Ordering

436
Projection

437
Joining

438
Grouping

443
Understanding Method-Based LINQ Queries

445
Filtering

445
Ordering

446
Projection

446
Joining

449
Grouping

454
Aggregate Functions

455
first and last

456
Concatenation

457
Skip and Take

459
Distinct

459
Utilizing LINQ to XML

461
Summary

462
Chapter Test Questions

463
Additional Reading and Resources

465
Review of Key Terms

467
xxv
C
h
A
p
TER 11:
IN
p
UT VALIDATION, DEBUGGING,

AND INSTRUMENTATION

469
Input Validation

470
Avoiding Validation

470
Triggering Validations

471
Validating Data

472
Using Built-in Functions

473
Using String Methods

474
Using Regular Expressions

475
Using Sanity Checks

483
Managing Data Integrity

494
Using Database Validations

494
Using Assertions

494
Debugging

497
Preprocessor Directives

498
#define and #undef

498
#if, #elif, #else, and #endif

498
#warning and #error

500
#line

500
#region and #endregion

500
#pragma warning

501
#pragma checksum

503
Predefined Compiler Constants

503
Debug and Trace

504
Debug and Trace Objects

505
Listeners

506
Programming Database Files

508
Instrumenting Applications

509
Tracing

509
Logging and Event Logs

509
Profiling

511
Using a Profiler

511
Profiling by Hand

513
Using Performance Counters

514
Summary

517
Chapter Test Questions

518
Additional Reading and Resources

521
Cheat Sheet

522
Review of Key Terms

525
xxvi
C
h
A
p
TER 12:
USING ENCRY
p
TION AND

MANAGING ASSEMBLIES

527
Using Encryption

528
Choosing an Appropriate Encryption Algorithm

529
Symmetric Encryption

529
Asymmetric Encryption

534
Stream Encryption

536
Hashing Data

538
Managing and Creating Certificates

542
Implementing Key Management

547
Choosing When to Use Which

548
Managing Assemblies

551
What Is an Assembly?

551
Understanding Assembly Versions

552
Signing Assemblies Using Strong Names

555
Implementing Side-by-Side Versioning

558
Adding Assemblies to the Global Assembly Cache

562
Summary

564
Chapter Test Questions

564
Additional Reading and Resources

567
Cheat Sheet

568
Review of Key Terms

569
A
pp
ENDIX:
ANSWERS TO SAM
p
LE TEST QUESTIONS

571
Chapter 1: Introducing the Programming in C# Certification

571
Chapter 2: Basic Program Structure

571
Chapter 3: Working with the Type System

572
Chapter 4: Using Types

573
Chapter 5: Creating and Implementing Class Hierarchies

574
Chapter 6: Working with Delegates, Events, and Exceptions

575
Chapter 7: Multithreading and Asynchronous Processing

577
Chapter 8: Creating and Using Types with Reflection,
Custom Attributes, the CodeDOM, and Lambda Expressions

578
Chapter 9: Working with Data

580
Chapter 10: Working with Language Integrated Query (LINQ)

582
Chapter 11: Input Validation, Debugging, and Instrumentation

584
Chapter 12: Using Encryption and Managing Assemblies

585
INDEX

587
INTRODUCTION
W
h
EN WE FIRST TALKED ABOUT WRITING T
h
IS BOOK,

our idea was to offer a way to our readers to
learn to program using C#, and the byproduct of this process was for you to pass the 70-483 certifica-
tion exam given by Microsoft. Being certified on specific technologies helps you in many ways. First, it
helps you understand which parts are considered by the specialists to be important. Second, it helps you
to understand a new technology by having a goal. Finally, it helps you in your career because certifica-
tions are recognized by employers, and this can give you advantage over other applicants.
W
h
O T
h
IS BOOK IS FOR
Microsoft recommends that you have at least 1 year of experience programming in C# before
attempting to take Exam 70-483. In addition, we recommend that you have some experience with
other programming languages, although it is not necessary. If you are an experienced programmer,
we recommend you to skim the chapters you are familiar with and read in detail those chapters
you are not so confident about. If you are a novice programmer, we recommend you read the entire
book, and make sure you understand all the chapter test questions and the study the Cheat Sheet at
the end of every chapter.
W
h
AT T
h
IS BOOK COVERS
This book covers C# language version 5.0 and .NET Framework version 4.5. We tried to cover all
the skills measured by Exam 70-483, with each chapter focusing on specific key objectives. We
provide, as well, many representative sample test questions that are similar to the ones used by
Microsoft. You can find these questions at the end of every chapter.
h
OW T
h
IS BOOK IS STRUCTURED
Instead of following the test objectives as they were specified by Microsoft, this book follows a more
natural approach to learning, where the knowledge base is built gradually.
In every chapter in this book you can find the following parts:
➤➤
A table showing how each chapter correlates to the test objectives
➤➤
Real-world case scenarios and code labs with solutions
➤➤
Advice, warnings, best practices, common mistakes, notes, and sidebars to point out impor-
tant material
➤➤
Chapter test questions structured similar to how you will see questions on the exam
➤➤
Additional reading and resources
xxviii


Cheat Sheets
➤➤
Review of key terms
NOTE

The chapter test questions and answers, the Cheat Sheet, and Review of
Key Terms are also available on the website for you to download and print.
Following is a breakdown of each chapter’s focuses:
Chapter 1, “Introducing the Programming C# Certification Test”: This chapter introduces you
to the Microsoft certification process and to the specifics of the 70-483 Programming in C#
certification.
Chapter 2, “Basic Program Structure”: This chapter covers the topics necessary for you to be suc-
cessful in understanding core functionality in the C# programming language. Key topics enable
you to learn about statements in C#, both simple and complex. At the end of this chapter, you will
understand how to create basic programs in C#.
Chapter 3, “Working with the Type System”: This chapter covers the type system in C#. You learn
about value and reference types, how to define them, and how to use them. You also learn the basic
concepts of object-oriented programming.
Chapter 4, “Using Types”: This chapter talks about how to work with types, convert between data
types, and work with dynamic types. After that you explore different ways to work with strings.
Chapter 5, “Creating and Implementing Class Hierarchies”: This chapter continues the discussion
about object-oriented programming (started in Chapter 3), and describes how to create class hierar-
chies and classes that implement common .NET interfaces. It also covers the object’s life cycle and
how to handle unmanaged resources.
Chapter 6, “Working with Delegates, Events, and Exceptions”: This chapter continues the discus-
sion started in Chapter 3 about the type system and talks about two special data types: exceptions
and delegates. After that, it discusses how to work with delegates to create and use events.
Chapter 7, “Multithreading and Asynchronous Processing”: This chapter shows you how to improve
the performance of your application by using threads, tasks, and the new asynchronous program-
ming paradigm introduced in C# 5.0.
Chapter 8, “Creating and Using Types with Reflection, Custom Attributes, the CodeDOM, and
Lambda Expressions”: Reflection is the capability to analyze code dynamically, read, modify,
and even invoke behavior dynamically. You learn how to define metadata for your code by using
Attribute
classes. You also learn how to create code generators using the CodeDOM. Finally, you
learn how to query sets of data using expression- and method-based lambda expressions.
Chapter 9, “Working with Data”: This chapter looks at different ways to work with data sets. It dis-
cusses arrays, collections, and technologies such as ADO.NET, ADO.NET Entity Framework, and
WCF Data Services and how to work with the I/O system.
xxix
Chapter 10, “Working with Language Integrated Query (LINQ)”: This chapter covers ways to query
data by using the Language Integrated Query.
Chapter 11, “Input Validation, Debugging, and Instrumentation”: This chapter starts by talking
about different ways to validate data input. After that it continues to talk about ways to debug and
instrument applications to minimize the errors.
Chapter 12, “Using Encryption and Managing Assemblies”: This chapter covers two apparently
unrelated technologies. First, you cover encryption to understand how to ensure data integrity and
privacy. After that you cover ways to manage assemblies as deployment units.
W
h
AT YOU NEED TO USE T
h
IS BOOK
To run the samples in the book, you need the following:
➤➤
A computer running Windows 7 or above
➤➤
Visual Studio 2012 Professional Edition or above. If you don’t have this version, you
can download a 90-day trial version from Microsoft (see
http://www.microsoft.com/
visualstudio/eng/downloads
).
The source code for the samples is available for download from the Wrox website at
www.wrox.com/
remtitle.cgi?isbn=1118612094
.
CONVENTIONS
To help you get the most from the text and keep track of what's happening, we’ve used a number of
conventions throughout the book.
REAL-WORLD CASE SCENARIO

Sample Scenario
The Real-World Case Scenario is an exercise similar to what may appear on the test. You should work
through problems, following the text in the book.
Solution
After each Real-World Case Scenario, the example is explained in detail.
CODE LAB

Sample Code Lab
The Code Lab focuses on code highlights discussed earlier. You must understand how and why this code
is used for the purpose shown to pass the test.
xxx
Solution
After each Code Lab, the code and what it does is explained in detail.
COMMON MISTAKES
These boxes highlight mistakes you have made or seen others make. Here, you get a
chance to learn from others’ hard-learned lessons.
BEST
p
RACTICES
You are reading this book primarily to pass the MCSD Certification test. This fea-
ture covers topics highlighted because they are important for the test but also for
common work practices.
ADVICE FROM T
h
E EX
p
ERTS
In these boxes you can find advice from the authors. We’ve been there before, and
we want you to learn from what we’ve learned.
EXAM TI
p
S AND TRICKS
Here, you can find information that focuses on the Microsoft certification test or
test-taking skills in general.
WARNING

Warnings hold important, not-to-be-forgotten information directly rel-
evant to the surrounding text.
NOTE

Notes point out important facts for you to remember.
xxxi
As for styles in the text:
➤➤
We highlight new terms and important words when we introduce them.
➤➤
We show keyboard strokes like this: Ctrl+A.
➤➤
We show filenames, URLs, and code within the text like so:
persistence.properties
➤➤
We present code in two different ways:
We use a monofont type with no highlighting for most code examples.
We use bold to emphasize code that is particularly important in the present
context or to show changes from a previous code snippet.
STUDY MATERIAL AND CODE ON T
h
E WEBSITE
As you work through the examples in this book, you may choose either to type in all the code man-
ually or to use the source code files that accompany the book. All the source code used in this book
is available for download at
www.wrox.com
. Specifically for this book, the code download is on the
Download Code tab at
www.wrox.com/remtitle.cgi?isbn=1118612094
.
You can also search for the book at
www.wrox.com
to find the code. Alternatively, you can go to
the main Wrox code download page at
www.wrox.com/dynamic/books/download.aspx
to see the
code available for this book and all other Wrox books.
At the beginning of each chapter, you can find the location of the major code files for the chapter.
Throughout each chapter, you can also find references to the names of code files as needed in listing
titles and text.
Most of the code on
www.wrox.com
is compressed in a ZIP, RAR archive, or similar archive format
appropriate to the platform. After you download the code, just decompress it with an appropriate
compression tool.
NOTE

Because many books have similar titles, you may find it easiest to search
by ISBN; this book’s ISBN is 978-1-118-61209-5.
In addition to the code, on the website you will also find the sample test questions and answers
included in this book, as well as additional sample test questions and answers not included in this
book to help you practice for the 70-483 certification exam.
ERRATA
We make every effort to ensure that there are no errors in the text or in the code. However, no one
is perfect, and mistakes do occur. If you find an error in one of our books, such as a spelling mistake
or faulty piece of code, we would be grateful for your feedback. By sending in errata, you may save
another reader hours of frustration, and at the same time, you can help us provide even higher quality
information.
xxxii
To find the errata page for this book, go to
www.wrox.com/remtitle.cgi?isbn=1118612094
and
click the Errata link. On this page you can view all errata that has been submitted for this book and
posted by Wrox editors.
If you don’t spot “your” error on the Book Errata page, go to
www.wrox.com/contact/techsupport
.shtml
and complete the form there to send us the error you have found. We’ll check the information,
and if appropriate post a message to the book’s errata page and fix the problem in subsequent editions
of the book.
p
2
p .
WROX
.
COM
For author and peer discussion, join the P2P forums at
http://p2p.wrox.com
. The forums are a web-
based system for you to post messages relating to Wrox books and related technologies and interact
with other readers and technology users. The forums offer a subscription feature to e
-
mail you topics
of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other
industry experts, and your fellow readers are present on these forums.
At
http://p2p.wrox.com
, you can find a number of different forums that can help you, not only as
you read this book, but also as you develop your own applications. To join the forums, just follow
these steps:

1
.

Go to
http://p2p.wrox.com
and click the Register link.

2
.

Read the terms of use and click Agree.

3
.

Complete the required information to join and any optional information you want to

provide, and click Submit.

4
.

You will receive an e
-
mail with information describing how to verify your account and

complete the joining process.
NOTE

You can read messages in the forums without joining P2P, but to post
your own messages, you must join.
After you join, you can post new messages and respond to messages other users post. You can read
messages at any time on the web. If you would like to have new messages from a particular forum
e
-
mailed to you, click the Subscribe to This Forum icon by the forum name in the forum listing.
For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to
questions about how the forum software works, as well as many common questions specific to P2P
and Wrox books. To read the FAQs, click the FAQ link on any P2P page.
Introducing the Programming C#
Certification
W
h
AT YOU WILL LEARN IN T
h
IS C
h
A
p
TER
➤➤
Getting certified
➤➤
Understanding Microsoft certifications
➤➤
Understanding Microsoft certification exams
➤➤
Studying for the exam
This chapter is an introduction to Microsoft certifications in general and the Programming C#
certification more specifically. In this chapter, you learn about the world of Microsoft certifi-
cations and why you might consider taking this exam and getting certified. The chapter also
presents information on how exam questions are considered and written for Microsoft exams
and describes how you can use this book to study for Exam 70-483.
A complete list of the topic areas that are covered on Exam 70-483 is also included to help you
understand what to expect for objectives of each exam as you work toward your MCPD certi-
fication using the C# programming language.
Due to the nature of the content of Chapter 1, there are no code downloads for this chapter.
GETTING CERTIFIED
Certifications have been around for many years. Hardware manufacturers certify components,
car dealers provide certified used cars, developers certify software to run on specific operating
systems—and that’s just to name a few.
1
2



C
h
A
p
TER 1

Introduc
I
ng the Programm
I
ng
c
#
c
ert
I
f
I
cat
I
on
What this basically means is that the term certification can have many different definitions depend-
ing on the context in which it is used. In this book, certification refers to Microsoft certifications.
(Specifics about Microsoft certification are presented in the section “What Is MS Certification?”
later in this chapter.) Like many other large companies in the IT industry, Microsoft has established
and maintains a certification program to show developers’ aptitude in designing and developing pro-
grams using Microsoft’s products.
Although each organization, including Microsoft, has its own certification program, benefits, and
requirements, there are still a lot of similarities among certifications. For example, most, if not all
organizations, deliver their certification exams through an exam delivery partner (EDP). This has
typically been through EDPs such as Prometric, Pearson Vue, and Certiport.
Each program requires that the candidate register in the program and take specific exams and
meet certain requirements before the participant is awarded a certification. Some programs require
one exam for a certification credential, and others require multiple exams. For example, Cisco,
Microsoft, Adobe, Novell, and Oracle all have certifications you can earn by taking one knowledge-
based exam. Some certifications are more difficult than others.
The more complex, multi-exam scenarios are found in the high-end certifications such as the
Microsoft Certified Master (MCM), which is changing to Microsoft Certified Solutions Master
(MCSM), or Cisco Certified Internetworking Expert (CCIE) certifications. These certifications and
exams require much more than just a knowledge-based exam. These certifications require a candi-
date to complete lab-based portions, meaning that the participant performs actual tasks in either a
real or emulated environment.
For the Cisco exam, you visit the testing center and configure the necessary network switches, rout-
ers, and firewalls according to a specification. The exam team then introduces bugs, or essentially
breaks your configuration, and you have to troubleshoot the issues and fix it.
The MCM program has different requirements depending on the certification you are seeking.
For most of the MCM certifications, you attend classroom training, take knowledge-based exams,
and take a final lab-based exam over a 21-day period—that is, 21 days straight with no breaks in
between. Some of the MCM programs permit the candidate to take training at different institutions
and then take the requisite knowledge-based exams with a final performance-based lab-style exam
at the end, hosted by Prometric.
Obviously, the more stringent the requirements for a certification, the more credibility the certifica-
tion holds in the industry. It also means a higher cost, but with that rigorous certification in hand,
you can also demand—and usually get—more money for consulting fees or a higher salary. But that
is getting into the next section: why you should get certified.
Why Get Certified?
Obviously, if you purchased this book, you have already decided to get a certification, or at least
take a certification exam. Of course you may also be just borrowing the book because you are curi-
ous about what might be involved in getting certified. Either way, this section describes some of the
reasons why you might consider getting certified.
Getting Certified



3
Having spent a lot of time pursuing certifications in the past, plus working as a Certification Product
Planner, the reasons I have come across are varied and many. For the most part, to the reasons are
summarized and rationalized for why certifications are good and why you may want to pursue them.
In the IT industry, especially in the realm of the developer world, most of the programmers who
have been in the industry for some time came through academia and hold university degrees, typi-
cally in computer science. When you think about it, a Bachelor or Master’s degree is a certification
from a certain perspective. The degree shows the world that the person whose name is indicated on
the degree certificate has met the requirements as set forth by a board of some sort, usually the uni-
versity faculty and a governing body.
Not every programmer, database developer, database administrator, or other IT professional, how-
ever, has attended a four-year degree program at a university. Many have instead taken classes at
two-year certificate programs. Whatever the institution or schooling background, upon successfully
completing the program, students acquire a diploma, certificate, degree, or other named piece of
documentation that indicates they have achieved some specific level of knowledge.
One of the problems that graduates face after completing these programs is that the knowledge
they gained during the course of their schooling is actually outdated to a certain extent. You might
think computer science concepts don’t change at their core, and to a great extent, you are correct.
But what does change are the technology and tools IT professionals use every day in their pursuit
of the computer science career upon which they have embarked. A good example of this is how the
Internet and the World Wide Web have changed your concept of what an application is. Just in the
short lifespan of the web, you have seen the technology change from static pages with hyperlinks to
pages supporting Cascading Style Sheets, JavaScript, ActiveX controls, server-side programming,
state-management, and so on. None of these technologies or concepts were taught just a short time
ago, yet they are relevant and important today.
Employers looking to hire programmers for developing websites that contain these technologies
require some way to identify who has those skills. The Bachelor of Science document certainly
doesn’t indicate this. Actually, there isn’t any way for an employer to know what courses a holder
of a degree has actually taken unless the student provides a transcript. There isn’t any way to show
an employer what knowledge and skills were gained after attending a university either outside of a
resume or perhaps a portfolio.
Industry certifications are a way to address some of these issues. When properly implemented, secured,
and executed on, industry certifications are an effective way to show existing and potential employers
some important information. Certifications can provide the person who holds the credential, the fol-
lowing benefits:
➤➤
Validation of knowledge
➤➤
Validation of skills
➤➤
A way to show continuing education
➤➤
A means to prove a commitment to maintaining skills
Whatever your reasons for pursuing a certification, you must understand the value of the certifica-
tion you intend to acquire and perhaps even the process by which the certifications are developed
4



C
h
A
p
TER 1

Introduc
I
ng the Programm
I
ng
c
#
c
ert
I
f
I
cat
I
on
and maintained. The next few sections present an insight into Microsoft certifications, including
what certifications Microsoft makes available, how they fit into the overall certification portfolio for
Microsoft, and an insider’s view of how the certifications are planned, created, and delivered.
EXAM
p
IRACY AND BRAIN DUM
p
S
Many opponents to certifications cite reasons such as exam piracy and brain dumps
for their opposition. Some indicate that employers don’t value certifications, and
therefore they aren’t worth the money you would spend on them. Others, such as
programmers, tell you that they don’t work in a world of multiple choices, so a
multiple-choice test isn’t representative of their skills and knowledge.
Microsoft is not the only company affected by exam piracy and brain dumps. Any
certification program is subject to these same issues. Although there are certain
methods in existence to help deal with these problems, they can never be totally
eradicated.
Microsoft is actively taking steps to counter some of these issues by performing
exam analysis, in the form of statistical forensics, to help identify cheaters and exam
centers that are at the heart of the problem. Over the past few years, it has been suc-
cessful in shutting down testing centers that participate in exam piracy and websites
that contribute to brain-dump activities. Because of the way the Internet works,
however, it is impossible to completely stop all the brain-dump sites.
One of the best ways to help combat these issues is through the use of education
and cooperation with certified professionals. Any time someone asks you for a brain
dump or a way to cheat on a Microsoft exam, ensure that you explain the benefit of
achieving the certification honestly and report any cheating activity to Microsoft.
You can help drive the acceptance of your certifications and help to improve the
reputation of these exams by helping to reduce exam piracy and cheating.
What Is MS Certification?
Microsoft certifications have evolved over the years. The exams have changed in their content,
and the process for creating the exams has changed somewhat as well. Like most certification pro-
grams, the changes are based on customer feedback, changes in the industry, and standards board
certifications.
Microsoft certifications are most commonly known as MCP certifications. MCP stands for Microsoft
Certified Professional. To understand the Microsoft certification landscape, look at some terminology,
what certifications are available from Microsoft, and how to obtain them.
Throughout this chapter, the terms certification and credential are used interchangeably. A certifica-
tion is defined as a “title” that candidates can use after they complete the requirements set forth for
that certification. Credential is another word for a certification. Again, it is a title that candidates
can use after completing the requirements for that credential.
D
ownload from Wow! eBook <www.wowebook.com>
Getting Certified



5
An example of a certification would be Microsoft Certified Solutions Associate (MCSA),
Microsoft Certified Solutions Developer (MCSD), Microsoft Certified Solutions Expert (MCSE),
or Microsoft Certified Solutions Master (MCSM). The following sections describe each of these
designations.
Certification Changes
The MCSD and older Microsoft Certified Systems Engineer (MCSE) certifications served the indus-
try well for many years. Like all programs, changes and improvements were a necessity. Some of
these changes were brought about by the need to streamline requirements and simplify the program,
whereas other driving reasons were employers and hiring managers.
As technology changes, IT professionals either keep their skills up to date or they do not. This can
create a bit of an issue for hiring managers trying to discern qualifications from resumes submitted.
For example, programmers could indicate that they hold an MCSD certification, but don’t tell the
hiring manager what programming language was used to achieve the credential. If the hiring man-
ager is looking for a developer who could program using C++, the certification didn’t actually tell
them that. Also, what elective exam did candidates use? How much web experience did they have as
opposed to Windows development experience?
Both candidates and hiring managers provided feedback to Microsoft, telling them that it was not
easy to determine just what the certification name meant or what requirements were needed for a
certification. The elective system made it difficult to determine qualifications. Other feedback indi-
cated that one certification didn’t necessarily map to the way the industry thought about job roles
and skills qualifications.
As a result of this feedback and industry research, Microsoft made changes to the program and cre-
ated new certifications and new exams to help address these issues and needs. It termed this new
program the New Generation of Certifications and labeled the old system as Legacy Certifications.
Then, just a few short years following that change, Microsoft introduced the current version of cer-
tifications, which is the third iteration of the certification, or cert, program. These changes are not
designed to confuse you, but instead are intended to help ensure that your credentials have validity
and meaning in the workforce.
The Initial Certifications (Version One)
The first iteration of the Microsoft certification program created a base credential known as MCP.
This was the starting point for any of the higher certifications that consisted of:
➤➤
MCSE
➤➤
MCSD
➤➤
MCDBA (Microsoft Database Administrator)
These were the mainstream certifications that existed in version one of the Microsoft certification
programs. They served Microsoft well for a number of years, and these three credentials became
well known in the industry.
6



C
h
A
p
TER 1

Introduc
I
ng the Programm
I
ng
c
#
c
ert
I
f
I
cat
I
on
A New Generation of Certifications (Version 2)
As with any program, there is the potential not to meet the needs of every concerned party. Feedback
to, and research by, Microsoft Learning resulted in some changes to the certification program. The
changes were designed to address a couple of key areas: job roles and knowledge validation.
Both of these areas have some commonality. Hiring managers needed a way to identify which spe-
cific technologies a potential job candidate might have, and they needed a way to map the certifica-
tions to job roles. Only developer certifications are covered here.
Microsoft Certified Technology Specialist (MCTS)
For validating knowledge on a technical subject, Microsoft created the Microsoft Certified Technology
Specialist (MCTS) credential. The MCTS certification is not considered to be an entry-level certifica-
tion but is aimed at candidates who want to prove their knowledge and skills on a specific Microsoft
technology.
To achieve an MCTS certification, the candidate would have to pass one or more exams. The MCTS
certifications and exams also allowed Microsoft to provide a more valid way of testing candidates’
knowledge and skills on a technology by permitting them to include more complete coverage of that
technology. To explain this a little better, consider how the older MCSD certification focused on
either web or Windows development, which is not bad, except that these two platforms encompass a
lot of different programming skill sets.
By using the MCTS exam focus and the different technologies that Microsoft was releasing, ade-
quate coverage of each different technology could now be included in a separate exam. This allowed
Microsoft to provide sufficient coverage of a technology on an exam and also clearly state what that
technology is. Candidates passing that exam would have proven their knowledge and skills on that
technology. Hiring managers now had a way to determine what the job candidate was certified on.
Microsoft Certified Professional Developer (MCPD)
Microsoft also created another layer of certification known as the professional level. This credential
is titled Microsoft Certified Professional Developer (MCPD). To achieve an MCPD credential, the
candidate must pass any prerequisite MCTS certifications along with the MCPD exam.
The MCPD exams are designed to test a candidate’s ability to work as a team lead or development
lead and make decisions around application designs. There are also not as many MCPD credentials
as there are MCTS credentials, and this is to support the fact that they are intended to focus on a
job role as opposed to a breadth of technologies.
The Current Microsoft Certifications (Version 3)
The current version of Microsoft certifications changes the focus a bit more by looking at credentials
such as Specialist and Solutions Experts or Solutions Developers. The changes made for the current
set of credentials were designed to do the following:
➤➤
Reduce the number of entry points
➤➤
Reduce the number of certifications
➤➤
Clarify certification paths
Getting Certified



7
➤➤
Enable single base certification to lead to multiple advanced certifications
➤➤
Streamline the program into a seamless process
Again, the reasons for changing the certification program were in response to industry feedback and
research. As noted in the preceding list, the previous generations of certifications were still confus-
ing due to the number of entry points into the program, with multiple paths and many different cer-
tifications and exams. The current program focuses on three levels of certification.
There are three main tiers in the latest certification program:
➤➤
Solutions Associate level: Designed to be the foundation for certifications in Microsoft prov-
ing technical skills.
➤➤
Solutions Expert level: Expands on the knowledge of those at the Associate level and requires
more rigor in the exams and knowledge tested. Candidates at this level should be able to
build solutions using multiple technologies including cloud computing.
➤➤
Solutions Master level: The top of the Microsoft certification program. Consists of certifica-
tions that require knowledge-based exams along with performance-based testing. Those who
hold a Masters certification demand higher salaries.
Other Microsoft Certifications: The MTA
All the preceding certifications can be thought of as the technical certifications. Think of technical
certifications as a set of exams and credentials intended to validate skills. There is another set of cre-
dentials that fall under the acronym MTA (Microsoft Technology Associate).
Actually, Microsoft is careful not to actually refer to the MTA as a certification. It is more of a cer-
tificate. The MTA is aimed at high school students and post-secondary institutions that offer two-
year certificate programs; although, four-year universities can certainly deliver them as well.
Although the exams are technical in nature, they are designed to be entry level, and 80 percent of
the content is intended to be knowledge level as opposed to implementation-specific. What that
means is the questions are designed to test candidates on their understanding of the concepts, such
as the following:
➤➤
What is a class in object-oriented programming(OOP)?
➤➤
What is a tuple in a database?
The MTA exams are used by some schools to augment their existing tests, and sometimes to replace
them, for determining a student’s knowledge of a subject area. These exams are also designed to
serve a few more purposes, the most pertinent being that they provide students with a sense of
achievement, helping them to realize their progression in their learning. Plus, they provide a means
to introduce students to the world of certifications by exposing them to a Microsoft exam environ-
ment. If they pass the exam, they get access to the Microsoft Certified Professional community,
where they can start preparing for the more technical certifications with the help of the MCP com-
munity and resources available there. The MTA has been well received by the academic community.
8



C
h
A
p
TER 1

Introduc
I
ng the Programm
I
ng
c
#
c
ert
I
f
I
cat
I
on
T
h
INGS TO KNOW ABOUT T
h
E TEST
For most developers and IT professionals outside of Microsoft, or even Microsoft Learning, the exam
development process is a black box. For a developer, it’s analogous to a Windows Communication
Foundation (WCF) service. You know how to call it and get a result back, but you have no real insight
into the algorithms that make it work. You can guess at it, but you’re never quite certain.
It’s always an eye-opening experience when someone steps into the process for the first time and sees
what it takes to create these exams. The next section describes how the exam questions are written,
but first it can help you to understand how an exam is created.
h
ow the Test Is Created
At one time, Microsoft certification exams focused on product features. After all, it was the features
of the product that developers were using to create their applications, and it was the features of the
product that customers asked for, so it stood to reason that the features of the product were the
important aspects to be testing on. Or does that logic make sense?
The history of these exams has shown that this methodology doesn’t quite present a good test-
ing experience, nor does it provide any validation that a candidate can actually use the features. It
merely shows that developers can memorize what a feature is or does. The current process has been
put in place to overcome these issues and to address some others as well. Psychometrics has been
added to the certification exams. Psychometrics is a field of study dealing with the theories and
techniques used to validate knowledge and skills through a measurement process. In this case, this
measurement is a test. Before getting into how psychometrics is involved, first look at how the exam
envisioning and design has changed to better address industry needs.
Microsoft releases new versions of software, on average, about every two years. A Product Manager
and a Product Planner in Microsoft Learning work together to evaluate the changes in the next ver-
sion of the product and how it will impact the industry. For example, a careful evaluation was made
of all the technologies that make up Microsoft’s .NET Framework to determine how the new fea-
tures will be applied by developers in creating Windows or web-based applications. How have the
data access mechanisms changed? What is new in WCF services?
After this information is evaluated, the Product Manager and Product Planner start to seek out
developers in the industry who use these new technologies in their organization. As you can imag-
ine, these developers will typically be early adopters who partner with Microsoft to gain access to
early builds of the software. They also consist of Microsoft Most Valuable Professionals (MVPs)
and Microsoft Certified Trainers (MCT). The criteria are clear. These developers must use the new
software in real-world scenarios, and can describe how the new features are used and will be used
by the industry.
Microsoft then hosts focus group sessions, typically in Redmond, Washington, with these industry
experts to determine how the technologies are used. These sessions do not focus on features only.
The sessions are designed to extract product-usage scenarios from these experts on how they use the
technology, regardless of feature sets, in the real world. Obviously, there must be a focus on the new
aspects of the software, or the exam becomes a rehash of the previous version.
Things to Know About the Test



9
The exam prep guide is the output of this focus group—well, sort of. The prep guide structure is
explained a bit later in the section that details the objectives that this exam will test on, but for
now, just know that the prep guide is the result of the focus group. The information taken from
the focus group is formulated into the exam design document that gets a further validation pass by
more industry experts. This validation step is known as a blueprinting process, where other indus-
try experts who have never seen the list before and who did not participate in the focus group can
look at each outlined objective and rate it based on relevancy, importance, and frequency. These
values are fed into a spreadsheet that executes some magical psychometric formulas that spit out
the number of required exam questions for each objective to appropriately measure the candidate’s
knowledge on the test. After the blueprinting is complete and the data is assembled, the exam ques-
tion writing can begin. Note that as of the writing of this book, the exam questions are still in mul-
tiple choice or true/false format. Some newer items are being tested that consist of drag-and-drop or
choosing code segments, but the bulk of the questions are multiple choice.
NOTE

Microsoft is committed to moving to a performance-based testing envi-
ronment for all its certifications at some point. There are many hurdles to over-
come before it is a reality, but that will change the face of Microsoft certifications
considerably.
h
ow Questions Are Written
Just how do the questions get written? Microsoft Learning works with various partners to create
the content for the exams in a clear process that is guided and overseen by the Product Planners, the
Content Development Managers, and the Project Managers at Microsoft.
Taking the exam design document and the blueprint values, a team of item writers is assembled
to begin the process. These item writers must be industry experts as well, who work with the
technology on a daily basis. They receive training on effective exam question writing.
This might sound a little strange at first. You may be saying to yourself, “Why would you need
to have training on how to write a test question? If you know the technology, you can write a test
question on it.”
Although there is some truth to that thought, writing an effective exam question is not always an
easy task. Here are the reasons why:
➤➤
The question must test the objective it maps to.
➤➤
The question must be worded in a technically accurate and correct form.
➤➤
Slang or nicknames cannot be used. (An example of this is in the IT world where in North
America the acronym DMZ has been used to represent the perimeter network for security
purposes. In certain other countries, DMZ has negative connotations.)
➤➤
Wording and terms must take into account translation into other languages.
10



C
h
A
p
TER 1

Introduc
I
ng the Programm
I
ng
c
#
c
ert
I
f
I
cat
I
on
➤➤
Each question must be legally defensible. That is to say, if the question is asking for one answer,
there can be only one correct answer among the available answer choices. All other answers
must be 100 percent incorrect.
➤➤
The writer cannot make up technologies or answers that do not exist in the product just to
provide a wrong answer.
➤➤
Questions cannot be tricky with subtle wording that hides clues.
➤➤
Questions cannot be simply recall questions where a candidate would normally look up the
answer in MSDN or use IntelliSense. An example would be writing a question that tests the
order of parameters for a method call for a class in the base class library.
➤➤
One question on the exam cannot give away the answer to another question on the exam.
➤➤
Questions must be written to the correct cognitive level.
As you can see, there are quite a few rules involved in the acceptance criteria for the questions. Most
writers think they will turn out their questions with minimal trouble because they know the technology
so well, but they soon find out that good exam questions take hard work and careful thought.
After the questions have been written, the next formal part of the process is to hold an Alpha ses-
sion. The Alpha session typically involves the lead item writer plus six to eight more subject matter
experts who go over each written question. The original item writers are not involved in this process
so that nobody’s feelings get hurt when the questions are critically reviewed. It also helps the subject
matter experts in the room to focus on being honest about the question’s merits.
Any problematic questions either get fixed or completely rewritten during this five-day session. The
output of this session is the set of questions included in the beta version of the exam. The beta version is
where as many as 500 sets of eyes have a chance to evaluate the questions. Each beta candidate has the
opportunity to provide comments and feedback on the items at the end of the exam. The feedback and
comments are reviewed after the beta has completed, and a post-beta session is held where even more
subject matter experts are involved. The task this time is to validate the comments and feedback, and
then to set the passing score for the exam. At this stage, any questions that did not perform well on the
exam or have technical issues are deleted from the final pool of exam questions.
This entire process can take anywhere from six to nine months from the design phase to release of
an exam. The exam’s planning process starts much sooner than that, of course, but the actual exam
design, development, testing, and release portion can take this long.
EXAM TI
p
S AND TRICKS
Not every process is perfect, and even with this many subject matter experts looking
at exam questions, some minor issues can escape notice. When you take the exam,
remember there is a comment period at the end where you can submit your feedback
on the exam or on individual questions. Don’t be afraid to be brutally honest. At the
same time, ensure that you provide usable feedback. Responses such as “This question
stinks” are not actionable and do not identify issues with the question. The feedback
can go a long way to help improve the quality of the exam questions.
How to Study for the Exam Using This Book



11
h
OW TO STUDY FOR T
h
E EXAM USING T
h
IS BOOK
And now you come back to the reason why you bought this book. Your objective is to study for and
pass the exam, and you purchased this book to help you do that. Outside of the great information
presented in this book, you gain advice on how you can use the book more effectively to help in
your exam preparation.
Although there are many ways to start preparing for an exam, only a structured method helps to ensure
success. Typically, when looking at exam preparation, a candidate faces a situation similar to an author
staring at the first blank page for a book he is writing. Where do you start? Not only that, but you
may also be thinking that preparing is going to be hard because you don’t know what you don’t know.
You’re not sure you want to study everything because you should already know most of the content that
will be covered, but how do you know what to focus on? The following sections can help you determine
just that.
p
rep Guide
The first thing you should do is to focus on the exam prep guide that lists the objectives for the exam.
(The objectives are included at the end of this chapter for your convenience, but you can also find them
at
www.microsoft.com/learning/en/us/exam.aspx?ID=70-483
.) These objectives provide you with
an idea as to what could be covered on the exam. There is a caveat that comes with the prep guides,
however. You may notice the following wording under each objective that states,
“This objective may include but is not limited to….”
This text is an indication that the listed items after this text are the identified areas of coverage from
the exam design sessions. The list is typically not complete for various reasons, such as not all topics
were thought of during the design or complete coverage may not be possible.
Regardless of the reasons that there may not be complete coverage, the items are just indicators of
what you may see a question written on. The other issue is that the exam designers and the item writ-
ers are, for the most part, different people. This means that the person writing the exam question was
not present during the exam design and therefore was not privy to the conversations around this topic.
They also have their own experiences that they bring to the process for what they will draw upon for
writing the questions they have been assigned.
This doesn’t mean there is a disconnect in the process or it is flawed. It is similar to the exams you
took in school. You were expected to understand the subject to the extent that you could answer
any question on the subject. You were not given explicit topic coverage on those exams either. These
exams are similar in the prep guides in that they offer a little more information as to what may be
covered, but as long as you fully understand the subject, you should be able to answer any question
related to it.
Functional Groups
So step one is complete; you have reviewed the prep guide and evaluated the objectives, and now you
have an idea what the exam questions will test on. Before you spend time studying topics, you should
rate what you think your knowledge is for each of these objectives. Don’t worry too much about the
12



C
h
A
p
TER 1

Introduc
I
ng the Programm
I
ng
c
#
c
ert
I
f
I
cat
I
on
bolded items in the objectives listed here (the ones with the percentage ratings in parentheses). Those
items are known as Functional Groups, and they are a convenient way to group related objectives. The
percentage listed gives you an idea of how much of the exam a particular Functional Group will take
up. You can use this value to determine where to focus your time studying if you want.
p
ractice Questions
After you have the objectives rated, turn your attention to practice questions. Practice test questions
are a great way to evaluate your knowledge against what you think you know, and against reality.
They are also a great way to focus your mind on how the exams are written and what the experi-
ence may be like when you take the actual exam. The other advantage you gain from the practice
questions is the ability to identify your weak areas, allowing you to focus your study and maximiz-
ing your investment in preparation.
p
reparation
The preparation part is primarily where this book comes in. The chapters of this book map directly
to the exam objectives. This means that the book is focused training for the exam. This doesn’t
mean that it is a cheat sheet or a brain dump. To gain the most benefit, you need to read and under-
stand the content of the chapters. You also then get to apply that understanding through the code
labs in each chapter. These labs are designed to reinforce the theory presented in the chapter. Each
chapter will also contain practice questions, Cheat Sheets, and Key Terms to help you focus on the
right content.
The prep guide found on the Microsoft Learning Web site will help you to identify the key aspects
of the exam itself along with the skills measured, a list of preparation materials such as courses or
books, as well as a community section designed to provide resources from your fellow exam candi-
dates and developers. The community can be a great study resource as well.
The authors of the book have done their best to evaluate the exam objectives and to provide you
with material designed to help you prepare for the exam. Your study habits and how well you under-
stand the content presented here will be factors in your success. The more experience you gain with
the technology and the more you practice the labs in this book, the greater your chances to success-
fully pass the exam.
T
h
E 70-483 OBJECTIVES
The following section lists the objectives for Exam 70-483, the topic of this book. The objectives are
taken directly from the prep guides that you can find online at
www.microsoft.com/learning
under
the Certifications tab.
Manage
p
rogram Flow (25
p
ercent)
Under this category, you will find topics that deal with threading, program flow, events, callbacks,
and exception handling—all are important to managing how your application is executed.
The 70-483 Objectives



13
Implement Multithreading and Asynchronous Processing
This objective may include but is not limited to use the Task Parallel library (ParallelFor, Plinq, and
Tasks); create continuation tasks; spawn threads by using ThreadPool; unblock the UI; use async
and await keywords; and manage data by using concurrent collections.
See Chapter 7, “Multithreading and Asynchronous Processing.”
Manage Multithreading
This objective may include but is not limited to synchronize resources; implement locking; cancel a
long-running task; and implement thread-safe methods to handle race conditions.
See Chapter 7, “Multithreading and Asynchronous Processing.”
Implement Program Flow
This objective may include but is not limited to iterate across collection and array items; program
decisions by using switch statements, if/then, and operators; and evaluate expressions.
See Chapter 2, “Basic Program Structure.”
Create and Implement Events and Callbacks
This objective may include but is not limited to create event handlers; subscribe to and unsubscribe
from events; use built-in delegate types to create events; create delegates; lambda expressions; and
anonymous methods.
See Chapter 6, “Working with Delegates, Events, and Exceptions.”
Implement Exception Handling
This objective may include but is not limited to handle exception types (SQL exceptions, network
exceptions, communication exceptions, and network timeout exceptions); catch typed versus base
exceptions; implement
try-catch-finally
blocks; throw exceptions; determine when to rethrow
versus throw; and create custom exceptions.
See Chapter 6, “Working with Delegates, Events, and Exceptions.”
Create and Use Types (24
p
ercent)
Creating and using types will take you into the world of C# data. It covers the built-in types that
C# provides such as
int
and
string
but also delves into the more complex types such as structs,
enums, and classes.
Create Types
This objective may include but is not limited to create value types (structs, enum), reference types,
generic types, constructors, static variables, methods, classes, extension methods, optional and
named parameters, and indexed properties; and create overloaded and overridden methods.
See Chapter 3, “Working with the Type System.”
14



C
h
A
p
TER 1

Introduc
I
ng the Programm
I
ng
c
#
c
ert
I
f
I
cat
I
on
Consume Types
This objective may include but is not limited to box or unbox to convert between value types; cast
types, convert types, and handle dynamic types; and ensure interoperability with unmanaged code,
for example, dynamic keyword.
See Chapter 4, “Using Types.”
Enforce Encapsulation
This objective may include but is not limited to enforce encapsulation by using properties, by using
accessors (public, private, and protected), and by using explicit interface implementation.
See Chapter 3, “Working with the Type System.”
Create and Implement a Class Hierarchy
This objective may include but is not limited to design and implement an interface; inherit from a
base class; and create and implement classes based on
IComparable
,
IEnumerable
,
IDisposable
,
and
IUnknown
interfaces.
See Chapter 5, “Creating and Implementing Class Hierarchies.”
Find, Execute, and Create Types at Runtime Using Reflection
This objective may include but is not limited to create and apply attributes; read attributes; gener-
ate code at run time by using CodeDom and lambda expressions; and use types from the System.
Reflection namespace (Assembly, PropertyInfo, MethodInfo, and Type).
See Chapter 8, “Creating and Using Types with Reflection, Custom Attributes, the CodeDOM,
and Lambda Expressions.”
Manage the Object Life Cycle
This objective may include but is not limited to manage unmanaged resources; implement IDisposable,
including interaction with finalization; manage IDisposable by using the Using statement; and manage
finalization and garbage collection.
See Chapter 5, “Creating and Implementing Class Hierarchies.”
Manipulate Strings
This objective may include but is not limited to manipulate strings by using the
StringBuilder
,
StringWriter
, and
StringReader
classes; search strings; enumerate string methods; and format
strings.
See Chapter 4, “Using Types.”
Debug Applications and Implement Security (25
p
ercent)
This section focuses on aspects for understanding how you work with the tools and features of the
.NET Framework to debug your applications and for implementing security in your code for encryp-
tion and validation.
The 70-483 Objectives



15
Validate Application Input
This objective may include but is not limited to validate JSON data; data collection types; manage
data integrity; evaluate a regular expression to validate the input format; use built-in functions to
validate data type and content out of scope; and writing regular expressions.
See Chapter 11, “Input Validation, Debugging, and Instrumentation.”
Perform Symmetric and Asymmetric Encryption
This objective may include but is not limited to choose an appropriate encryption algorithm; man-
age and create certificates; implement key management; implement the System.Security namespace;
hashing data; and encrypt streams.
See Chapter 12, “Using Encryption and Managing Assemblies.”
Manage Assemblies
This objective may include but is not limited to version assemblies; sign assemblies using strong
names; implement side-by-side hosting; put an assembly in the global assembly cache; and create a
WinMD assembly.
See Chapter 12, “Using Encryption and Managing Assemblies.”
Debug an Application
This objective may include but is not limited to create and manage compiler directives; choose an
appropriate build type; and manage programming database files and symbols.
See Chapter 11, “Input Validation, Debugging, and Instrumentation.”
Implement Diagnostics in an Application
This objective may include but is not limited to implement logging and tracing; profiling applica-
tions; create and monitor performance counters; and write to the event log.
See Chapter 11, “Input Validation, Debugging, and Instrumentation.”
Implement Data Access (26
p
ercent)
Most applications work with data in some form or another. Data may be stored in database systems,
or it may be stored in flat files. Flat files may be text files, comma-separated value (CSV) files, or
XML files. Knowing how to access this data for reading and writing is crucial for developers.
Perform I/O Operations
This objective may include but is not limited to read-and-write files and streams; read and write
from the network by using classes in the System.Net namespace; and implement asynchronous
I/O operations.
See Chapter 9, “Working with Data.”
16



C
h
A
p
TER 1

Introduc
I
ng the Programm
I
ng
c
#
c
ert
I
f
I
cat
I
on
Consume Data
This objective may include but is not limited to retrieve data from a database; update data in a data-
base; consume JSON and XML data; and retrieve data by using web services.
See Chapter 9, “Working with Data.”
Query and Manipulate Data and Objects by Using LINQ
This objective may include but is not limited to query data by using operators (projection, join,
group, take, skip, and aggregate); create method-based LINQ queries; query data by using query
comprehension syntax; select data by using anonymous types; force execution of a query; and read,
filter, create, and modify data structures by using LINQ to XML.
See Chapter 10, “Working with Language Integrated Query (LINQ).”
Serialize and Deserialize Data
This objective may include but is not limited to serialize and deserialize data by using binary serial-
ization, custom serialization, XML Serializer, JSON Serializer, and Data Contract Serializer.
See Chapter 9, “Working with Data.”
Store Data in and Retrieve Data from Collections
This objective may include but is not limited to store and retrieve data by using dictionaries, arrays,
lists, sets, and queues; choose a collection type; initialize a collection; add and remove items from a
collection; use typed versus nontyped collections; implement custom collections; and implement col-
lection interfaces.
See Chapter 9, “Working with Data.”
SUMMARY
This chapter provided an overview of the Microsoft certification program and what to expect from