没有合适的资源?快使用搜索试试~ 我知道了~
Visual.C#2010从入门到精通]英文版
需积分: 11 1 下载量 74 浏览量
2012-12-05
19:18:13
上传
评论
收藏 17.61MB PDF 举报
温馨提示
试读
781页
Visual Studio 2010 .C#从入门到精通]英文原版,资料还是原汁原味的好,系统的学习C#,编程一步到位
资源推荐
资源详情
资源评论
Table of Contents
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Who This Book Is For. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xix
Finding Your Best Starting Point in This Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
Conventions and Features in This Book
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxi
Conventions
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxi
Other Features
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
Prerelease Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
Hardware and Software Requirements
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
Code Samples
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxiii
Installing the Code Samples
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxiii
Using the Code Samples
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxiii
Uninstalling the Code Samples
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxix
Find Additional Content Online. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxx
Support for This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxx
Questions and Comments
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxx
Introducing Microsoft Visual C# and Microsoft Visual Studio 2010
Welcome to C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Beginning Programming with the Visual Studio 2010 Environment. . . . . . . . . . 3
Writing Your First Program
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Using Namespaces
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Creating a Graphical Application
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Chapter 1 Quick Reference
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Working with Variables, Operators, and Expressions. . . . . . . . . . . . . 27
Understanding Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Using Identifiers
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Identifying Keywords
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Using Variables
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Naming Variables
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Declaring Variables
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Working with Primitive Data Types
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Unassigned Local Variables
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Displaying Primitive Data Type Values
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Using Arithmetic Operators
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Operators and Types
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Examining Arithmetic Operators
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Controlling Precedence
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Using Associativity to Evaluate Expressions
. . . . . . . . . . . . . . . . . . . . . . . . 42
Associativity and the Assignment Operator
. . . . . . . . . . . . . . . . . . . . . . . . 42
Incrementing and Decrementing Variables
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Prefix and Postfix
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Declaring Implicitly Typed Local Variables
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Chapter 2 Quick Reference
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Writing Methods and Applying Scope. . . . . . . . . . . . . . . . . . . . . . . . . 47
Creating Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Declaring a Method
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Returning Data from a Method
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Calling Methods
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
www.dotnety.com
www.dotnety.com
Microsoft
®
Visual C#
®
2010
Step by Step
John Sharp
www.dotnety.com
www.dotnety.com
PUBLISHED BY
Microsoft Press
A Division of Microsoft Corporation
One Microsoft Way
Redmond, Washington 98052-6399
Copyright © 2010 by John Sharp
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: 2009939912
Printed and bound in the United States of America.
1 2 3 4 5 6 7 8 9 QWT 5 4 3 2 1 0
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 infor mation 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 mspinput@microsoft.com.
Microsoft, Microsoft Press, Excel, IntelliSense, Internet Explorer, Jscript, MS, MSDN, SQL Server, Visual Basic, Visual
C#, Visual C++, Visual Studio, Win32, Windows, 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: Ben Ryan
Developmental Editor: Devon Musgrave
Project Editor: Rosemary Caperton
Editorial Production: Waypoint Press, www.waypointpress.com
Technical Reviewer: Per Blomqvist; Technical Review services provided by Content Master, a member of
CM Group, Ltd.
Cover: Tom Draper Design
Body Part No. X16-81630
www.dotnety.com
www.dotnety.com
iii
Contents at a Glance
Part I Introducing Microsoft Visual C# and Microsoft
Visual Studio 2010
1 Welcome to C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Working with Variables, Operators, and Expressions . . . . . . . . . 27
3 Writing Methods and Applying Scope . . . . . . . . . . . . . . . . . . . . . 47
4 Using Decision Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5 Using Compound Assignment and Iteration Statements . . . . . . 91
6 Managing Errors and Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . 109
Part II Understanding the C# Language
7 Creating and Managing Classes and Objects . . . . . . . . . . . . . . . 129
8 Understanding Values and References . . . . . . . . . . . . . . . . . . . . 151
9 Creating Value Types with Enumerations and Structures . . . . . 173
10 Using Arrays and Collections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
11 Understanding Parameter Arrays . . . . . . . . . . . . . . . . . . . . . . . . . 219
12 Working with Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
13 Creating Interfaces and Defining Abstract Classes . . . . . . . . . . 253
14 Using Garbage Collection and Resource Management. . . . . . . 279
Part III Creating Components
15 Implementing Properties to Access Fields . . . . . . . . . . . . . . . . . 295
16 Using Indexers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
17 Interrupting Program Flow and Handling Events . . . . . . . . . . . 329
18 Introducing Generics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
19 Enumerating Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
20 Querying In-Memory Data by Using Query Expressions . . . . . 395
21 Operator Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
www.dotnety.com
www.dotnety.com
iv Contents at a Glance
Part IV Building Windows Presentation Foundation
Applications
22 Introducing Windows Presentation Foundation . . . . . . . . . . . . 443
23 Gathering User Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
24 Performing Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
Part V Managing Data
25 Querying Information in a Database . . . . . . . . . . . . . . . . . . . . . . 535
26 Displaying and Editing Data by Using the Entity
Framework and Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Part VI Building Professional Solutions with
Visual Studio 2010
27 Introducing the Task Parallel Library . . . . . . . . . . . . . . . . . . . . . . 599
28 Performing Parallel Data Access. . . . . . . . . . . . . . . . . . . . . . . . . . 649
29 Creating and Using a Web Service . . . . . . . . . . . . . . . . . . . . . . . . 683
Appendix
Interoperating with Dynamic Languages . . . . . . . . . . . . . . . . . . 717
www.dotnety.com
www.dotnety.com
剩余780页未读,继续阅读
资源评论
laiz8
- 粉丝: 1
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功