Part Ⅰ C#:The Language 1
Chapter 1 Introduction to C# .NET and the .NET Platform 3
Overview of .NET 4
So,What Is .NET? 4
Application Development in .NET 5
The .NET Platform 6
The.NET Framework 6
The CLS-Common Language Specifications 7
The CLR-Common Language Runtime 7
MSIL-Microsoft Intermediate Language 8
The BCL-Base Class Library 9
The .NET Languages 9
Microsoft C# .NET 10
Basic C# Concepts 10
Startup 14
Declarations 15
Arrays 16
Access 17
Scopes 17
Object-Oriented Programming Concepts 18
A Brief History of Object-Oriented Programming 19
Just What Is an Object? 20
Structs Explained 21
The convert Routine Using an Object-Oriented Approach 22
Properties and Methods of an Object 23
Classes-Putting It All Together 25
Instance Data vs. Class Data 26
Static Methods 27
Abstraction and Encapsulation 28
Summary 31
Test Questions 32
Test Answers 33
Variables 34
Chapter 2 Variables and Program Structure 34
Value-Type Variables 35
Reference-Type Variables 37
Memory and Variables 37
Variable Declarations 38
Value-Type Variables on the Stack 38
The Parts of Reference-Type Variables 39
Implicit Conversions 40
Type Conversions 40
Conversion Methods 41
Boxing and Unboxing 41
Memory Management 42
Creating and Destroying Objects 42
Cleaning Up the Objects 43
The Structure of a C# Class File 44
Namespaces and the Using Directive 45
Comments 47
Coding Conventions 47
Lexical Structure 47
Identifiers 48
Constants and Read-Only Variables 49
Keywords 49
Literals 50
Operators 51
Statements and Expressions 53
Flow Control 55
Preprocessor Directives 60
Summary 61
Test Questions 61
Test Answers 62
Chapter 3 Advanced Object-Oriented Concepts 63
Introduction to Advanced OO Topics 64
Creating Methods to Hide Data 64
Using Properties to Hide Data 66
Inheritance Explained 67
Inheritance 67
Polymorphism 78
Method Overriding 79
Using Sealed 82
Abstract Classes 84
Interfaces 85
Why Use Interfaces? 86
Extending Interfaces 86
Overloading 87
Summary 89
Test Questions 89
Test Answers 92
Chapter 4 Strings,Exceptions,and Events 93
The String Class 93
System.String 93
String Building 95
String Formatting 97
Arrays 98
The System.Array Class 99
Collections 100
Overview of Exception Handling 102
Throwing and Catching Exceptions 103
Coding to Handle Errors and Exceptions 104
Creating Your Own Exceptions 109
Event Handling 110
Delegates 111
Events 115
Summary 116
Test Questions 116
Test Answers 119
Chapter 5 Visual Studio .NET Development Environment 120
What is Visual Studio .NET? 120
The Start Page 121
Get Started 122
Downloads 124
Online Community 124
Types of Projects 125
Creating a Project 125
Projects 125
Building the Project 126
Grouping Projects into Solutions 127
Customizing Visual Studio .NET 129
Customizing with the Start Page 129
Customizing with the Options Dialog Box 129
Explorers 130
The Interface 130
Tools 134
Other Highlights of Visual Studio .NET 137
Summary 138
Test Questions 138
Test Answers 139
Part Ⅱ The C# Exams:Common Elements 141
The .NET Assembly 143
Chapter 6 Assemblies 143
Versioning 144
Deployment 144
Security 144
What Is in the Assembly? 145
Working with a .NET Assembly 145
Creating and Modifying a .NET Assembly 147
Strongly Named Assemblies and GAC 148
Creating and Implementing Satellite Assemblies 149
Summary 150
Test Questions 150
Test Answers 151
Chapter 7 Resources and Localization 152
String Resources 152
Localized Formatting 156
Implementing Right-to-Left Mirroring and Encoding 158
Test Questions 160
Summary 160
Best Practices 160
Test Answers 162
Chapter 8 XML and C# Documentation 163
Introduction to XML 163
What Is XML 164
HTML vs. XML 164
Creating an XML Document 168
XML Declaration and Processing Instructions 168
Why Use XML? 168
Comments 169
Elements 169
Attributes 170
A Well-Formed XML Document 170
XML Documentation in C# 171
XML Documentation Tags 171
XML Comments and Visual Studio .NET 173
Test Questions 175
Summary 175
Test Answers 177
Chapter 9 Debugging and Testing 178
Debugging Your Application 178
The Buggy Application 179
Two Debuggers-CorDbg and DbgCLR 181
Using the Visual Studio .NET Debugging Capabilities 185
.NET Diagnostics 188
Debugging an ASP.NET Application 194
Testing Your Application 194
Purpose of Testing 195
Developing a Test Plan 195
Summary 197
Test Questions 198
Test Answers 199
Chapter 10 Basic Data-Access Techniques 200
ADO.NET 200
Application Models 201
ADO.NET Architecture 206
XML and ADO.NET 209
Data-Access Basics 209
SQL 209
ACID Rules(Transactions) 219
Connecting to a Data Provider 220
Database Security 221
Connection Strings 221
Connections 222
Connection Pooling 224
Error Handling 224
The Command Object 226
The DataSet Object 228
ADO.NET and XML 229
Loading XML into a DataSet 229
Writing XML from a DataSet 231
Using the XmlDataDocument Object 233
Using the DataAdapter to Access Existing Data 234
Creating the DataAdapter 235
Updating the Data Source 236
Resolving Conflicts 237
Summary 238
Test Questions 239
Test Answers 241
Part Ⅲ Exam 70-315:Developing and Implementing Web Applications 243
The Internet:Its Standards 245
Chapter 11 Welcome to the Internet and ASP.NET 245
The TCP/IP Protocols 246
HTML 247
HTTP 248
XML 249
Internet Architecture 250
Static Web Pages—the Beginning 250
Dynamic Web Pages—the Client Story 252
Dynamic Web Pages—the Server Story 253
The Internet Technologies 254
Client-Side Technologies 255
Server-Side Technologies 255
ASP.NET 257
Hello Web World! 257
The Object Model of ASP.NET 259
The Request Object 261
The Response Object 262
The Server Object 264
State or No State 264
The Application Object 265
The Session Object 267
Summary 268
Test Questions 268
Test Answers 270
Introduction to Web Forms 271
Chapter 12 Web Forms:Client-Side Programs 271
Building Your First Web Form 272
Adding Controls to a Form 276
HTML Server Controls 278
Web Server Controls 280
Validation Controls 288
Custom and User Controls 292
Creating an Address Book Web Form 292
Test Questions 302
Summary 302
Test Answers 304
Chapter 13 Server-Side Programs and Postback Operations 305
The ASP.NET Object Model 306
ASP.NET Namespaces 306
The Page Class 307
State Management 311
Web Services 320
How to Write a Web Service 321
How to Consume a Web Service 324
COM Interoperability 327
Platform Invoke 331
ASP.NET and Events 332
The Postback Event 333
Summary 338
Test Questions 338
Test Answers 341
Working with ASP Controls 343
Chapter 14 Server Controls in ASP.NET 343
Base Properties of Server Controls 344
HTML Server Controls 345
Web Server Controls 348
User Controls and Custom Controls 352
Building and Using a User Control 353
Building and Using a Custom Control 356
Dynamic Control Creation 360
Test Questions 362
Summary 362
Test Answers 364
Chapter 15 Web Forms and User Interface 365
The Importance of the User Interface 365
Localization 366
The Resource Manager Class 371
Page Navigation 374
Validation Revisited 374
Error Handling 378
Custom Error Pages 379
Page_Error() 381
Event Log 381
Page-Level Tracing 383
Summary 387
Test Questions 388
Test Answers 390
Chapter 16 Consuming and Manipulating Data from Data Sources 391
Using a DataGrid Server Control 392
Visual Studio .NET Support for Data 392
Creating and Using Stored Procedures 396
Data Binding 399
Error Handling 401
Accessing Data Programmatically 402
Connecting to a Data Source 403
Creating and Configuring a Command Object 404
Populate the DataSet with the Data from the Command 405
The Completed Web Form 405
Building a Data Form 407
Creating the SQL Statement 407
Building the Form 408
Retrieving Real-Time Data 413
Looking Up the Address Info 416
Summary 418
Test Questions 418
Test Answers 421
Chapter 17 Making the Web Application Available to Our Users 422
Deploying a Web Application 422
Caching and Improving Performance 423
Configuring a Web Application 426
Securing a Web Application 432
Deploying a Web Application 437
Installing a Web Application 442
Installing IIS 442
Installing FrontPage Server Extensions 443
Summary 444
Test Questions 444
Test Answers 447
Part Ⅳ Exam 70-316:Developing and Implementing Windows-Based Applications with Microsoft Visual C# .NET and Microsoft Visual Studio .NET 449
Chapter 18 Introduction to Windows Forms 451
Windows Forms 451
System.Windows.Forms Namespace and More 452
What Is a Form? 453
The Windows Forms Designer 460
A Closer Look at Forms 464
Using Visual Inheritance 467
Localizing Your Form 469
Controls 471
Adding Controls to a Form 471
Types of Controls 473
Setting Properties of Controls 475
Event Handling 476
What Is an Event? 476
What Happens When an Event Occurs? 477
Delegates 477
Creating Event Handlers 479
Summary 481
Test Questions 481
Test Answers 485
Working with Controls 486
Chapter 19 User-Interface Components 486
Specifying a Control s Location on a Form 487
Aligning Controls on a Form 489
Managing Control Focus 492
Windows Forms Controls 493
Buttons,Text Boxes,and Labels,Oh My! 494
List Boxes,Combo Boxes,Checked List Boxes,and Such 500
Tab Controls 501
Status Bars 502
Toolbars 503
Dialog Boxes 504
Working with Controls at Run Time 507
Working with Menus 509
Creating a Main Menu 509
Looking at the Code of a Main Menu 511
Handling Menu Events 512
Context Menus 512
Validating User Input 513
Validating Events 514
ErrorProvider Control 515
Summary 516
Test Questions 516
Test Answers 518
Chapter 20 Data in Windows Forms 520
Review of ADO.NET Object Model 520
Accessing Data Using Visual Studio .NET 521
ADO.NET Objects in Visual Studio.NET 522
The College Application 522
Using Stored Procedures 531
What s Next? 532
Data Binding 533
The Theory of Data Binding 533
Binding Data at Design Time 534
Binding Data at Run Time 537
BindingContext and CurrencyManager 538
Exception Handling 539
Creating a Connection Object 542
Accessing Data Programmatically 542
Creating a Command Object 543
DataAdapter and DataSet 544
DataReader 547
Using Format and Parse 548
The Format Event 548
The Parse Event 548
Summary 549
Test Questions 549
Test Answers 553
Chapter 21 Web Services and COM 554
Web Services 554
How Do Web Services Work? 555
Building a Simple Web Service 555
Consuming a Simple Web Service 559
How Web Services Work 561
.NET and COM 564
COM and COM+ 564
Working with COM 565
Behind the Scenes with COM 567
Platform Invoke 568
Summary 569
Test Questions 569
Test Answers 572
Chapter 22 Build Your Own Windows Control 573
Methods of Building Windows Controls 573
Extending an Existing Control 574
Creating Composite Controls 578
Building Custom Controls 586
Visual Studio .NET Support 587
Using Visual Inheritance 587
Adding Design-Time Support to Your Control 590
Adding a Toolbox Bitmap 590
Providing Other Design-Time Support 592
Adding Attributes to Properties 592
Hosting Your Control in Internet Explorer 593
Licensing a Control 593
Summary 595
Test Questions 595
Test Answers 601
Chapter 23 Deploying a Windows-Based Application 602
Review of Assemblies 602
Installing an Assembly into GAC 603
Strong Named Assemblies 603
Precompiling Assemblies 604
Deploying a Windows Application 605
Creating a Setup Project 606
Creating a Web Setup Project 614
Creating a CAB Project 615
Creating a Merge Module Project 616
Conforming to Windows Standards 616
Security Policies 617
Summary 618
Test Questions 619
Test Answers 620
Chapter 24 Configuring a Windows Application 622
Configuring a Windows Application 622
Machine Configuration File 623
Application Configuration File 624
Security Configuration File 625
.NET Framework Configuration Tool 625
XML Configuration Tags 630
Optimizing a Windows Application 631
Debug vs.Release Versions 631
Precompiling 633
Other Performance Enhancements 633
Securing a Windows Application 635
Code-Access Security 635
Role-Based Security 639
Providing User Assistance 641
Providing User Help 641
Adding Accessibility Features 645
Localizing a Windows Form 647
Using System.Drawing 648
Summary 650
Test Questions 650
Test Answers 653
Part Ⅴ Exam 70-320:Developing XML Web Services 655
Chapter 25 Introduction to XML Web Services and Server Components 657
The Standards 657
XML(Extensible Markup Language) 658
SOAP(Simple Object Access Protocol) 661
XML Web Services 666
UDDI(Universal Description,Discovery,and Integration) 672
XSD,XSLT,and XPath 674
Control Debugging in web.config 679
Logging Test Results and Debugging 679
Logging Test Results in an XML Web Service 680
Implementing Tracing in an XML Web Service 681
Summary 682
Test Questions 682
Test Answers 685
Chapter 26 Windows Services 687
Introducing Windows Services 687
Building a Windows Service 690
Creating an Installer for the Service 693
Creating the Setup Project for the Windows Service 694
Installing the Windows Service 696
Verifying the Service Logging 699
Windows Service Architecture 700
Quick Facts on Windows Services 701
Monitoring the Windows Service 702
Multi-Tiered Architecture 706
Server Components 706
COM and COM+ 707
Serviced Components 708
Using the Component Services Tool 714
Summary 719
Test Questions 720
Test Answers 724
What Is .NET Remoting? 725
Chapter 27 .NET Remoting 725
Terms and Terminology 726
.NET Remoting Architecture 728
Steps for Invoking a Server Object s Methods 732
Using .NET Remoting 732
Building the Remote Object 733
Building the Remote Server 734
Building the Client 735
Running the Remote Application 736
Configuring .NET Remoting 737
Creating the Remote Object Configuration File 738
Creating the Remote Object 738
Creating the Client 740
Creating the Client Configuration File 741
Setting Up IIS to Host the Server 742
Client-Activated Objects 744
Managing the Lifetime of a Server Object 745
Performance Considerations 746
.NET Remoting vs. Web Services 746
Final Considerations 746
Points to Remember 747
Summary 747
Test Questions 748
Test Answers 754
Chapter 28 XML Web Services 755
Introducing XML Web Services 755
Distributed Applications 755
XML Web Services in a Nutshell 758
XML Web Services Architecture 759
XML Web Service Provider 760
XML Web Service Consumer 760
XML Web Service Broker 761
XML Web Services Programming Model 761
Building an XML Web Service 762
Creating the Project 762
Implementing the Web Methods 768
Setting the Web Method Attributes 770
The Project Files 771
XML Web Service Consumers 772
WSDL 772
Discovering XML Web Services 776
Proxies for XML Web Services 778
Building an XML Web Service Consumer 778
Asynchronous Web Methods 782
SOAP Extensions 784
Summary 784
Test Questions 785
Test Answers 787
Chapter 29 Data Again 788
ADO.NET and XML Web Services 788
The ADO Objects Revisited 788
DataSets 790
DataSet Schemas 790
DataSet Relationships 796
Document Object Model(DOM) 804
XML Data 804
XmlReader 808
Transformations and XML 812
Validating XML 816
Microsoft SQL Server and XML Support 819
Summary 819
Test Questions 820
Test Answers 823
UDDI Registry 824
Deploying an XML Web Service 824
Chapter 30 Deployment and Security 824
Deployment 830
Securing an XML Web Service 830
Authentication 830
Authorization 835
Secure Communication 837
Access Unmanaged Code Using InterOp 839
Using a COM Component 839
Test Questions 841
Summary 841
Test Answers 846
Part Ⅵ Appendixes 847
Appendix A About the CD-ROM 849
Appendix B The New Microsoft Developer Tracks 852
Appendix C Command-Line Syntax 861
Appendix D The .NET Class Library 867
Appendix E Glossary 878