MCTS Self-Paced Training Kit (Exam 70-536)
Total Page:16
File Type:pdf, Size:1020Kb
● ● ● ● ● ● ● ● ● ● ● How to access your CD files The print edition of this book includes a CD. To access the CD files, go to http://aka.ms/626195/files, and look for the Downloads tab. Note: Use a desktop web browser, as files may not be accessible from all ereader devices. Questions? Please contact: [email protected] Microsoft Press Additional Resources for Developers from Microsoft Press ® ® Published and Forthcoming Titles on Microsoft Visual Studio Visual Basic Programming Microsoft Data Access Inside Microsoft Windows Visual C# 2008: Communication Foundation ® Microsoft Visual Basic 2008 The Language Microsoft ADO.NET 2.0 Justin Smith Step by Step Express Edition: Donis Marshall 978-0-7356-2306-4 Build a Program Now! 978-0-7356-2540-2 Rebecca M. Riordan Patrice Pelland 978-0-7356-2164-0 Other 978-0-7356-2541-9 Programming Microsoft Programming Microsoft Developer Topics Visual C# 2005: Microsoft Visual Basic 2008 The Language ADO.NET 2.0 Debugging Microsoft Step by Step Core Reference Donis Marshall .NET 2.0 Applications Michael Halvorson 978-0-7356-2181-7 David Sceppa John Robbins 978-0-7356-2537-2 978-0-7356-2206-7 978-0-7356-2202-9 Programming Microsoft Microsoft Visual Basic 2005 Visual C# 2005: Programming the Microsoft I. M. Wright’s “Hard Code” Step by Step The Base Class Library ADO.NET Entity Framework Eric Brechner Michael Halvorson Francesco Balena David Sceppa 978-0-7356-2435-1 978-0-7356-2131-2 978-0-7356-2308-8 978-0-7356-2529-7 The Practical Guide to ® Programming Windows CLR via C#, Programming Microsoft Defect Prevention Services with Microsoft Second Edition ADO.NET 2.0 Applications Marc McDonald, Robert Advanced Topics Visual Basic 2008 Jeffrey Richter Musson, Ross Smith Michael Gernaey 978-0-7356-2163-3 Glenn Johnson 978-0-7356-2253-1 978-0-7356-2433-7 978-0-7356-2141-1 Software Estimation: Programming Microsoft Web Development .NET Framework Demystifying the Black Art Visual Basic 2005: Steve McConnell Microsoft ASP.NET 3.5 Windows Presentation The Language Step by Step 978-0-7356-0535-0 Foundation: Francesco Balena George Shepherd A Scenario-Based Approach 978-0-7356-2183-1 The Security 978-0-7356-2426-9 Billy Hollis Development Lifecycle 978-0-7356-2418-4 Visual C# Microsoft ASP.NET 2.0 Michael Howard Step by Step Steve Lipner Microsoft Visual C#® 2008 3D Programming for 978-0-7356-2214-2 Express Edition: George Shepherd Windows Build a Program Now! 978-0-7356-2201-2 Charles Petzold Code Complete, Patrice Pelland 978-0-7356-2394-1 Second Edition 978-0-7356-2542-6 Programming Microsoft Steve McConnell ASP.NET 3.5 Microsoft Windows 978-0-7356-1967-8 Microsoft XNA™ Game Dino Esposito Workflow Foundation Studio 2.0 Express: Learn 978-0-7356-2527-3 Step by Step Software Requirements, Programming Now! Kenn Scribner Second Edition Rob S. Miles Programming Microsoft 978-0-7356-2335-4 Karl E. Wiegers 978-0-7356-2522-8 ASP.NET 2.0 Core Reference 978-0-7356-1879-4 Microsoft Windows Microsoft Visual C# 2008 Dino Esposito Communication Foundation More About Software Step by Step 978-0-7356-2176-3 Step by Step Requirements: Thorny John Sharp John Sharp Issues and Practical Advice 978-0-7356-2430-6 Programming Microsoft 978-0-7356-2336-1 ASP.NET 2.0 Applications Karl E. Wiegers Advanced Topics 978-0-7356-2267-8 Microsoft Visual C# 2005 Applications = Code + Step by Step Dino Esposito Markup: A Guide to the John Sharp 978-0-7356-2177-0 Microsoft Windows 978-0-7356-2129-9 Presentation Foundation Charles Petzold 978-0-7356-1957-9 microsoft.com/mspress PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2009 by Tony Northrup All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Control Number: 2008935429 Printed and bound in the United States of America. 1 2 3 4 5 6 7 8 9 QWT 3 2 1 0 9 8 Distributed in Canada by H.B. Fenn and Company Ltd. A CIP catalogue record for this book is available from the British Library. Microsoft Press books are available through booksellers and distributors worldwide. For further information about international editions, contact your local Microsoft Corporation office or contact Microsoft Press International directly at fax (425) 936-7329. Visit our Web site at www.microsoft.com/mspress. Send comments to [email protected]. Microsoft, Microsoft Press, Active Directory, Internet Explorer, MS, MSDN, MS-DOS, OpenType, Outlook, SQL Server, Visual Basic, Visual C#, Visual C++, Visual Studio, Win32, Windows, Windows NT, Windows Server, and Windows Vista are either registered trademarks or trademarks of the Microsoft group of companies. Other product and company names mentioned herein may be the trademarks of their respective owners. The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. This book expresses the author’s views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Acquisitions Editor: Ken Jones Developmental Editor: Laura Sackerman Project Editor: Carol Vu Editorial Production: S4Carlisle Publishing Services Technical Reviewer: Kurt Meyer; Technical Review services provided by Content Master, a member of CM Group, Ltd. Cover: Tom Draper Design Body Part No. X15-12470 In loving memory of Chelsea Knowles iii About the Author Tony Northrup In the mid-1980s, Tony Northrup, MCTS, MCSE, CISPP, and MVP, learned to program in BASIC on a ZX-81 personal computer built from a kit. Later, he mastered 68000 assembly and ANSI C on the Motorola VERSAdos operating system before beginning to write code for MS-DOS. After a brief time with the NEXTSTEP operating system, Tony returned to a Microsoft platform because he was impressed by the beta version of Microsoft Windows NT 3.1. Although he has dabbled in other operating systems, Tony has since focused on Windows development in Microsoft Visual C++, Microsoft Visual Basic, C#, and Perl (for automation projects). Tony now develops almost exclusively for the .NET Framework. Tony started writing in 1997 and has since published more than a dozen technology books on the topics of development and networking. In addition, Tony has written dozens of articles at http://www.microsoft.com, covering topics ranging from securing ASP.NET applications to designing firewalls to protect networks and computers. Tony spends his spare time hiking through the woods near his Phillipston, Massachusetts, home. He’s rarely without his camera, and in the past six years has created what might be the largest and most popular publicly accessible database of nature and wildlife photographs on the Internet. Tony lives with his dog, Sandi, and his cat, Sam. For more information about Tony, visit http://www.northrup.org. Contents at Glance 1 Framework Fundamentals . 1 2 Input/Output . 67 3 Searching, Modifying, and Encoding Text . 97 4 Collections and Generics . 137 5 Serialization. 169 6 Graphics. 219 7 Threading . 269 8 Application Domains and Services . 315 9 Installing and Configuring Applications . 359 10 Logging and Systems Management . 399 11 Application Security . 447 12 User and Data Security . 521 13 Interoperating with COM . 603 14 Reflection . 631 15 Mail. .651 16 Globalization. 679 Answers. 705 Glossary. 761 Index . .769 vii Table of Contents Acknowledgments . .xxvii Introduction . xxix 1 Framework Fundamentals . .1 Before You Begin . 1 Lesson 1: Using Value Types . 2 Built-in Value Types . 2 How to Declare a Value Type Variable . 5 How to Create User-Defined Types . 6 How to Create Enumerations . 9 Lab: Declaring and Using Value Types . 10 Lesson Summary. .13 Lesson Review . 14 Lesson 2: Using Common Reference Types . 15 What Is a Reference Type? . 15 Comparing the Behavior of Reference and Value Types . 15 Built-in Reference Types . 17 Strings and String Builders . 17 How to Create and Sort Arrays . 19 How to Use Streams. 20 How to Throw and Catch Exceptions . 21 Lab: Working with Reference Types. 24 Lesson Summary. 29 Lesson Review . 29 Lesson 3: Constructing Classes . 32 What Is Inheritance?. .32 What Is an Interface? . 34 What do you think of this book? We want to hear from you! Microsoft is interested in hearing your feedback so we can continually improve our books and learning resources for you. To participate in a brief online survey, please visit: www.microsoft.com/learning/booksurvey/ ix x Table of Contents What Are Partial Classes? . 37 What Are Generics?. 38 Events . 43 What Are Attributes?. 46 What Is Type Forwarding? . 47 Lab: Create a Derived Class with Delegates. 48 Lesson Summary.