Wrox Home  
Search

Topic: C# and C++

MCSD Certification Toolkit (Exam 70-483): Programming in C# (1118612094) cover image

MCSD Certification Toolkit (Exam 70-483): Programming in C#

Tiberiu Covaci, Rod Stephens, Vincent Varallo, Gerry O'Brien
ISBN: 978-1-118-61209-5
Paperback
656 pages
May 2013
Other Available Formats: E-book
If you are an instructor, you may request an evaluation copy for this title.
Paperback Version: US $59.99 Add to Cart

About This Title  |  Download Code  |  Errata  |  P2P Forum for This Title

INTRODUCTION xxvii

CHAPTER 1: INTRODUCING THE PROGRAMMING 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

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

CHAPTER 2: BASIC PROGRAM 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

CHAPTER 3: WORKING WITH THE TYPE SYSTEM 59

Creating Value Types 61

Understanding Predefi ned Value Types 61

Working with Data Structures 66

Working with Enumerations 72

Creating Reference Types 76

Understanding Modifiers 77

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

CHAPTER 4: USING TYPES 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

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

CHAPTER 5: CREATING AND IMPLEMENTING CLASS HIERARCHIES 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

CHAPTER 6: WORKING WITH DELEGATES, EVENTS, AND EXCEPTIONS 207

Working with Delegates 208

Delegates 208

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

Predefi ned 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-fi nally Blocks 235

Unhandled Exceptions 238

Common Exception Types 240

SQL Exceptions 242

Overfl ow 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

CHAPTER 7: MULTITHREADING AND ASYNCHRONOUS PROCESSING 265

Creating Responsive Applications 266

Working with Threads 267

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

CHAPTER 8: CREATING AND USING TYPES WITH REFLECTION, CUSTOM ATTRIBUTES, THE CODEDOM, AND LAMBDA EXPRESSIONS 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

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

CHAPTER 9: WORKING WITH 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

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

CHAPTER 10: WORKING WITH 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

CHAPTER 11: INPUT 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

CHAPTER 12: USING ENCRYPTION 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

APPENDIX: ANSWERS TO SAMPLE 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 Refl ection,

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

Printer-Ready Version   Share This
With you wherever you go: pdf + ePub + kindle -- DRM-free