饭饭TXT > 学习管理 > 《Visual Studio 2010 高级编程(英文出书版)》作者:Nick Randolph/等【完结】 > [Visual.Studio.2010.高级编程].Professional.Visual.Studio.2010.txt

第 2 页

作者:Nick Randolph/等 当前章节:15371 字 更新时间:2026-6-18 14:51

Solutions; Jonathan Carter from Microsoft; and SharePoint extraordinaire Jeremy Thake, whose

acknowledGMents

feedback and suggestions greatly improved various chapters. Also thanks to my fellow coffee

drinkers and .NET developers who (unintentionally) remind me how much I still have to learn

about .NET development.

Special thanks to my parents, John and Wendy, who have always been there for me and who have

always provided me with the encouragement and support I needed to achieve my goals. Special

thanks also to my daughters Jasmin and Emily, who gave up countless cuddles and tickles so that

Daddy could find the time to write this book. I promise I’ll do my best to catch up on the tickles that

I owe you and pay them back with interest.

Most of all I would like to thank my extraordinarily supportive wife and best friend, Julie. She

knew exactly what she was getting herself into when I agreed to write this book, and yet she still

offered her full encouragement and support. Julie did way more than her fair share for our family

when I needed to drop everything except work and writing, and I am truly grateful for her love and

friendship.

—David Gardner

first and foreMost I’d like to thank my co-authors Nick and Dave for inviting me to join them

on this adventure. That act of trust and faith has sustained me during several very early morning

writing sessions. When I first appeared on the Perth .NET scene Nick and Dave welcomed me with

loads of friendly advice and conversation. It’s an atmosphere that the community here retains to this

day. A special thanks goes to Chris for racing me to the finish line. When one day we finally meet in

person, I think I owe you a drink.

Like most first-time authors I had no real clue what I was getting myself into when I agreed to write

this book. Thanks to the team at Wrox for patiently educating me. Special thanks goes to Kelly

Talbot who continually worked to keep me on schedule and who coordinated the team that made

my sections readable. Editing a technical book of this size has got to be an interesting challenge and

ensuring consistency across four authors must make it particularly difficult.

Writing a book is a great way to teach you just how much you still have to learn. While researching

material I was constantly surprised by the little corners of Visual Studio that I hadn’t previously

been aware of, but there was always someone hanging out on twitter with a useful link or comment.

There are too many of you to thank individually, so in true twitter style I’ll just say thanks and

know that you are all listening.

Finally, I would particularly like to thank Barbara, the wonderful woman I am so lucky to be married

to. When Nick and Dave first approached me about being involved in this book, I don’t think either

of us realized the impact it would have on our lives. Barbara gave me the courage and the support to

step up to the challenge and was ready to be banished from the house for whole weekends at a time,

taking the kids on wonderful (and tiring) adventures so that I could get a chapter completed. To her

and to my three beautiful children, Chiara, Caleb and Will, I promise I can come with you on the

next adventure. And I won’t write any more books for a while. I promise.

—Michael Minutillo

acknowledGMents

when i was inVited to Join Nick, Dave, and Michael in writing this book, I had no idea what

I was getting myself into. Writing is a gruelling and time-consuming process — far more than

I could have ever imagined. Each chapter is almost like writing a thesis in itself, but on a strict

time budget, only to move onto the next once it’s done. Knowing that thousands of people would

be reading my chapters and relying on the information that they contain only added to the stress,

but I am quite proud of what we’ve managed to produce, and hope that it gives you the skills and

knowledge to become a Visual Studio power user. It’s been a big learning curve, and I came to

realize how much I think and produce solely in code rather than in English. There’s a definite skill

in effectively expressing concepts in the written form, and I have a newfound appreciation and

respect for those who do it so well.

I’d like to thank Nick and Dave for inviting me to be a part of the team. I was very much honored

to be asked and to actually be involved in this project. My thanks go to all three of my co-authors:

Nick, Dave, and Michael. Despite being located at opposite sides of Australia I think we’ve worked

remarkably well as a team, and I appreciate all your effort, feedback, and encouragement. My thanks

also go to our editor Kelly Talbot, who kept us in check and valiantly (if not always successfully)

attempted to keep us on schedule. While I have received help from a number of people at Microsoft,

I must particularly thank Dustin Campbell and John Vulner who provided me with some valuable

help and answers.

On a personal note, I would like to thank my parents Michael and Narelle, whose hard work,

generosity, and love have been my inspiration.

—Chris Anderson

contents

IntroductIon xxxix

Part i: inteGrated deVeloPMent enVironMent

chaPter 1: a quick tour 3

Getting started 3

Installing Visual Studio 2010 3

Running Visual Studio 2010 5

The Visual studio iDe 7

Developing, Building, Debugging, and Deploying Your

First Application 9

summary 13

chaPter 2: the solution exPlorer, toolbox,

and ProPerties 15

The solution explorer 15

Common Tasks 17

The Toolbox 22

Arranging Components 24

Adding Components 25

Properties 26

Extending the Properties Window 28

summary 32

chaPter 3: oPtions and custoMizations 33

The start Page 33

Customizing the Start Page 34

Code Behind with User Controls 36

Window layout 39

Viewing Windows and Toolbars 39

Navigating Open Items 40

Docking 41

The editor space 43

Fonts and Colors 43

Visual Guides 44

contents

Full-Screen Mode 45

Tracking Changes 46

other options 46

Keyboard Shortcuts 46

Projects and Solutions 48

Build and Run 49

VB Options 50

importing and exporting settings 51

summary 52

chaPter 4: the Visual studio worksPace 53

The Code editor 53

The Code Editor Window Layout 53

Regions 54

Outlining 55

Code Formatting 55

Navigating Forward/Backward 57

Additional Code Editor Features 57

Split View 58

Tear Away (Floating) Code Windows 58

Creating Tab Groups 59

Advanced Functionality 59

The Command Window 61

The immediate Window 62

The Class View 63

The error list 64

The object Browser 64

The Code Definition Window 66

The Call Hierarchy Window 66

The Document outline Tool Window 68

HTML Outlining 68

Control Outlining 69

reorganizing Tool Windows 70

summary 71

chaPter 5: find and rePlace and helP 73

Quick find/replace 73

Quick Find 74

Quick Replace 75

Find Options 75

ConTenTs

Wildcards 75

Regular Expressions 76

Find and Replace Options 77

find/replace in files 78

Find in Files 78

Find Dialog Options 79

Results Window 79

Replace in Files 80

find symbol 81

navigate To 82

incremental search 82

accessing Help 83

Navigating and Searching the Help System 84

Configuring the Help System 85

summary 86

Part ii: GettinG started

chaPter 6: solutions, ProJects, and iteMs 89

solution structure 89

solution file format 91

solution Properties 92

Common Properties 92

Configuration Properties 93

Project Types 94

Project files format 96

Project Properties 96

Application 97

Compile (Visual Basic Only) 100

Build (C# and F# Only) 102

Build Events (C# and F# Only) 103

Debug 103

References (Visual Basic Only)

105

Resources 106

Services 107

Settings 108

Reference Paths (C# and F# Only)

108

Signing 109

My Extensions (Visual Basic Only)

110

Security 111

contents

Publish 111

Code Analysis (VSTS Premium and Ultimate Editions Only) 112

Web application Project Properties 113

Web 113

Silverlight Applications 114

Package/Publish Web 115

Package/Publish SQL 116

Web site Projects 116

summary 117

chaPter 7: intellisense and bookMarks 119

intellisense explained 119

General IntelliSense 120

Completing Words and Phrases 121

Parameter Information 127

Quick Info 128

Javascript intellisense 128

The JavaScript IntelliSense Context 129

Referencing another JavaScript File 129

intellisense options 130

General Options 131

Statement Completion 132

C#-Specific Options 132

extended intellisense 132

Code Snippets 133

XML Comments 133

Adding Your Own IntelliSense 133

Bookmarks and the Bookmark Window 133

summary 135

chaPter 8: code sniPPets and refactorinG 137

Code snippets revealed 138

Storing Code Blocks in the Toolbox 138

Code Snippets 138

Using Snippets in C# 139

Using Snippets in VB 140

Surround With Snippet 141

Code Snippets Manager 142

Creating Snippets 143

Reviewing Existing Snippets 144

ConTenTs

accessing refactoring support 147

refactoring actions 148

Extract Method

148

Encapsulate Field

150

Extract Interface

151

Reorder Parameters

153

Remove Parameters

154

Rename 154

Promote Variable to Parameter 155

Generate Method Stub 156

Organize Usings 156

summary 157

chaPter 9: serVer exPlorer 159

server Connections 159

Event Logs 160

Management Classes 162

Management Events 164

Message Queues 167

Performance Counters 169

Services 172

Data Connections 173

sharePoint Connections 174

summary 174

chaPter 10: ModelinG with the class desiGner 175

Creating a Class Diagram 176

The Design surface 177

The Toolbox 178

Entities 178

Connectors 179

The Class Details 180

The Properties Window 181

layout 181

exporting Diagrams 182

Code Generation and refactoring 182

Drag-and-Drop Code Generation

182

IntelliSense Code Generation

184

Refactoring with the Class Designer

185

contents

Modeling Power Toys for Visual studio 186

Visualization Enhancements 186

Functionality Enhancements 187

summary 188

Part iii: diGGinG deePer

chaPter 11: unit testinG

Your first Test Case 192

Identifying Tests using Attributes 200

Additional Test Attributes 200

asserting the facts 202

The Assert Class 203

The StringAssert Class 203

The CollectionAssert Class 204

The ExpectedException Attribute 204

initializing and Cleaning Up 206

TestInitialize and TestCleanup 206

ClassInitialize and ClassCleanup 206

AssemblyInitialize and AssemblyCleanup 207

Testing Context 207

Data 207

Writing Test Output 210

advanced Unit Testing 211

Custom Properties 211

Testing Private Members 213

Testing Code Contracts 214

Managing large numbers of Tests 216

summary 217

chaPter 12: docuMentation with xMl coMMents 219

inline Commenting 220

XMl Comments 220

Adding XML Comments 221

XML Comment Tags 222

Using XMl Comments 235

IntelliSense Information 237

Generating Documentation with GhostDoc 237

ConTenTs

Compiling Documentation with sandcastle 238

Task list Comments 241

summary 243

chaPter 13: code consistency tools

245

source Control 245

Selecting a Source Control Repository

246

Accessing Source Control 248

Offline Support for Source Control 253

Coding standards 254

Code Analysis with FxCop 254

Style Using StyleCop 258

Code Contracts 258

summary 260

chaPter 14: code Generation with t4 263

Creating a T4 Template 264

T4 Building Blocks 268

Expression Blocks 268

Statement Blocks 268

Class Feature Blocks 270

How T4 Works 272

T4 Directives 275

Template Directive 275

Output Directive 275

Assembly Directive 276

Import Directive 276

Include Directive 277

Troubleshooting 278

Design-Time Errors 278

Compiling Transformation Errors 279

Executing Transformation Errors 279

Generated Code Errors 280

Generating Code assets 280

Preprocessed Text Templates 284

Using Preprocessed Text Templates

286

Differences Between a Standard T4 Template 288

Tips and Tricks 289

summary 290

contents

chaPter 15: ProJect and iteM teMPlates

Creating Templates 291

Item Template 291

Project Template 295

Template Structure 296

Template Parameters 298

Template Locations 299

extending Templates 299

Template Project Setup 299

IWizard 301

Generating the Extended Project Template 306

starter Kits 308

online Templates 308

summary 309

chaPter 16: lanGuaGe-sPecific features 311

Hitting a nail with the right Hammer 311

Imperative 312

Declarative 312

Dynamic 312

Functional 313

What’s It All Mean? 314

a Tale of Two languages 314

Compiling without PIAs 315

Generic Variance 316

Visual Basic 321

Lambdas and Anonymous Methods 321

Implicit Line Continuation 322

Automatic Properties with Initial Values 322

Collection Initializers and Array Literals 323

Nullable Optional Parameters 324

Visual Basic PowerPacks 325

C# 325

Late Binding with Dynamic Lookup 325

Named and Optional Parameters 326

f# 327

Your First F# Program 327

Exploring F# Language Features 330

summary 331

Part iV: rich client aPPlications Part iV: rich client aPPlications

ConTenTs

chaPter 17: windows forMs aPPlications

335

Getting started 335

The Windows form 336

目录
设置
设置
阅读主题
字体风格
雅黑 宋体 楷书 卡通
字体大小
适中 偏大 超大
保存设置
恢复默认
手机
手机阅读
扫码获取链接,使用浏览器打开
书架同步,随时随地,手机阅读
首 页 < 上一章 章节列表 下一章 > 尾 页