Contents i Bart De Smet C # 5.0 UNLEASHED 800 East 96th Street, Indianapolis, Indiana 46240 USA C# 5.0 Unleashed Editor-in-Chief Copyright © 2013 by Pearson Education, Inc. Greg Wiegand All rights reserved. No part of this book shall be reproduced, stored in a retrieval Acquisitions Editor system, or transmitted by any means, electronic, mechanical, photocopying, record- Neil Rowe ing, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every Development Editor precaution has been taken in the preparation of this book, the publisher and author Mark Renfrow assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein. Managing Editor ISBN-13: 978-0-672-33690-4 Kristy Hart ISBN-10: 0-672-33690-1 Project Editor Andy Beaster Library of Congress Cataloging-in-Publication Data is on file. Printed in the United States of America Copy Editor Keith Cline First Printing: April 2013 Trademarks Indexer Brad Herriman All terms mentioned in this book that are known be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this Proofreader information. Use of a term in this book should not be regarded as affecting the validity Debbie Williams of any trademark or service mark. Technical Editor Warning and Disclaimer Christopher Wilcox Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an “as Editorial Assistant is” basis. The authors and the publisher shall have neither liability nor responsibility to Cindy Teeters any person or entity with respect to any loss or damages arising from the information contained in this book. Cover Designer Anne Jones Bulk Sales Sams Publishing offers excellent discounts on this book when ordered in quantity for Compositor bulk purchases or special sales. For more information, please contact Nonie Ratcliff U.S. Corporate and Government Sales 1-800-382-3419 [email protected] For sales outside of the U.S., please contact International Sales [email protected] Contents at a Glance Introduction ....................................................................................... 1 1 Introducing the .NET Platform ............................................................. 5 2 Introducing the C# Programming Language ........................................ 55 3 Getting Started with .NET Development Using C# .............................. 103 4 Language Essentials .......................................................................... 175 5 Expressions and Operators ................................................................ 251 6 A Primer on Types and Objects ......................................................... 301 7 Simple Control Flow ........................................................................ 351 8 Basics of Exceptions and Resource Management ................................. 407 9 Introducing Types ............................................................................ 463 10 Methods ......................................................................................... 501 11 Fields, Properties, and Indexers ......................................................... 547 12 Constructors and Finalizers ............................................................... 585 13 Operator Overloading and Conversions ............................................. 609 14 Object-Oriented Programming .......................................................... 649 15 Generic Types and Methods .............................................................. 701 16 Collection Types .............................................................................. 755 17 Delegates ........................................................................................ 789 18 Events ............................................................................................. 843 19 Language Integrated Query Essentials ................................................ 913 20 Language Integrated Query Internals ................................................. 977 21 Reflection ...................................................................................... 1057 22 Dynamic Programming .................................................................. 1119 23 Exceptions .................................................................................... 1175 24 Namespaces ................................................................................... 1221 25 Assemblies and Application Domains .............................................. 1241 26 Base Class Library Essentials ............................................................ 1301 27 Diagnostics and Instrumentation ................................................... 1373 28 Working with I/O .......................................................................... 1399 29 Threading and Synchronization ...................................................... 1443 30 Task Parallelism and Data Parallelism .............................................. 1513 31 Asynchronous Programming ........................................................... 1551 32 Introduction to Windows Runtime .................................................. 1643 Index ............................................................................................ 1671 Table of Contents Introduction 1 Who Should Read This Book? ................................................................... 2 What You Need to Know Before You Read This Book .................................. 2 How This Book Is Organized ..................................................................... 3 1 Introducing the .NET Platform 5 A Historical Perspective ............................................................................ 5 A 10,000-Feet View of the .NET Platform.................................................... 9 The Common Language Infrastructure ..................................................... 12 The Multilanguage Aspect of .NET ........................................................... 15 Introducing .NET Assemblies................................................................... 16 The Common Type System Explained ...................................................... 17 Executing Managed Code ....................................................................... 24 Diving into the Common Language Runtime ........................................... 32 The Base Class Library ............................................................................ 51 Summary .............................................................................................. 54 2 Introducing the C# Programming Language 55 The Evolution of C# ............................................................................... 55 A Sneak Peek at the Future ...................................................................... 95 Summary ............................................................................................. 102 3 Getting Started with .NET Development Using C# 103 Installing the .NET Framework ............................................................... 103 Your First Application: Take One ............................................................ 113 Visual Studio 2012 ................................................................................ 119 Your First Application: Take Two ............................................................ 127 Summary ............................................................................................. 173 4 Language Essentials 175 The Entry Point .................................................................................... 175 Keywords ............................................................................................. 181 A Primer on Types ................................................................................ 184 Built-In Types ....................................................................................... 190 Local Variables...................................................................................... 212 Intermezzo on Comments ..................................................................... 223 Arrays .................................................................................................. 230 Contents v The Null Reference ................................................................................ 239 Nullable Value Types ............................................................................. 243 Summary ............................................................................................. 249 5 Expressions and Operators 251 What Are Expressions? .......................................................................... 251 The Evaluation Stack ............................................................................. 255 Arithmetic Operators ............................................................................. 258 String Concatenation ............................................................................ 269 Shift Operators ..................................................................................... 274 Relational Operators .............................................................................. 275 Logical Operators .................................................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages134 Page
-
File Size-