[1146143818]Watson B. - C# 4.0 How-To.pdf

(5645 KB) Pobierz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
BEN WATSON
C # 4.0
HOW-TO
800 East 96th Street, Indianapolis, Indiana 46240 USA
870668424.005.png 870668424.006.png 870668424.007.png
C# 4.0 How-To
Copyright © 2010 by Pearson Education, Inc.
All rights reserved. No part of this book shall be reproduced, stored in a
retrieval system, or transmitted by any means, electronic, mechanical,
photocopying, recording, 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 precaution has been taken in
the preparation of this book, the publisher and author assume no responsi-
bility for errors or omissions. Nor is any liability assumed for damages
resulting from the use of the information contained herein.
ISBN-13: 978-0-672-33063-6
ISBN-10: 0-672-33063-6
Library of Congress Cataloging-in-Publication Data
Watson, Ben, 1980–
C# 4.0 how-to / Ben Watson.
p. cm.
Includes index.
ISBN 978-0-672-33063-6 (pbk. : alk. paper) 1. C# (Computer program
language) I. Title.
QA76.73.C154W38 2010
005.13’3—dc22
Editor-in-Chief
Karen Gettman
Executive Editor
Neil Rowe
Acquisitions Editor
Brook Farling
Development Editor
Mark Renfrow
Managing Editor
Kristy Hart
Project Editor
Lori Lyons
Copy Editor
Bart Reed
Indexer
Brad Herriman
2010002735
Proofreader
Sheri Cain
Printed in the United States of America
First Printing March 2010
Technical Editor
Mark Strawmyer
Trademarks
All terms mentioned in this book that are known to be trademarks or
service marks have been appropriately capitalized. Sams Publishing cannot
attest to the accuracy of this information. Use of a term in this book
should not be regarded as affecting the validity of any trademark or service
mark.
Publishing
Coordinator
Cindy Teeters
Designer
Gary Adair
Warning and Disclaimer
Every effort has been made to make this book as complete and as accu-
rate as possible, but no warranty or fitness is implied. The information
provided is on an “as is” basis. The author and the publisher shall have
neither liability nor responsibility to any person or entity with respect to any
loss or damages arising from the information contained in this book.
Compositor
Nonie Ratcliff
Bulk Sales
Sams Publishing offers excellent discounts on this book when ordered in
quantity for bulk purchases or special sales. For more information, please
contact
U.S. Corporate and Government Sales
1-800-382-3419
corpsales@pearsontechgroup.com
For sales outside of the U.S., please contact
International Sales
international@pearson.com
870668424.001.png
Contents at a Glance
Introduction ............................................................................................ 1
Part I: C# Fundamentals
1
Type Fundamentals ................................................................................. 7
2
Creating Versatile Types ........................................................................ 27
3
General Coding .................................................................................... 45
4
Exceptions ........................................................................................... 63
5
Numbers .............................................................................................. 77
6
Enumerations ....................................................................................... 99
7
Strings ............................................................................................... 109
8
Regular Expressions ........................................................................... 131
9
Generics ............................................................................................ 139
Part II: Handling Data
10
Collections ......................................................................................... 155
11
Files and Serialization ......................................................................... 177
12
Networking and the Web ..................................................................... 201
13
Databases ......................................................................................... 237
14
XML ................................................................................................... 261
Part III: User Interaction
15
Delegates, Events, and Anonymous Methods ........................................ 279
16
Windows Forms .................................................................................. 295
17
Graphics with Windows Forms and GDI+ .............................................. 329
18
WPF ................................................................................................... 365
19
ASP.NET ............................................................................................ 401
20
Silverlight ........................................................................................... 443
Part IV: Advanced C#
21
LINQ .................................................................................................. 461
22
Memory Management ......................................................................... 473
23
Threads, Asynchronous, and Parallel Programming ................................ 491
24
Reflection and Creating Plugins ........................................................... 519
25
Application Patterns and Tips .............................................................. 529
26
Interacting with the OS and Hardware .................................................. 575
27
Fun Stuff and Loose Ends ................................................................... 597
A
Essential Tools ................................................................................... 621
Index ................................................................................................. 633
870668424.002.png
Table of Contents
870668424.003.png
Contents
v
870668424.004.png
Zgłoś jeśli naruszono regulamin