Tải bản đầy đủ (.pdf) (7 trang)

a0090 apress pro c sharp 2008 and the dot net 3 5 platform 4th edition nov 200 morebook vn 8095

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (656.84 KB, 7 trang )

 CYAN
  MAGENTA

 YELLOW
  BLACK
  PANTONE 123 C

Books for professionals by professionals ®

The EXPERT’s VOIce ® in .NET
Free Companion eBook Available

Pro C# 2008 and the .NET 3.5 Platform, Fourth Edition
Dear Reader,

Pro VB 2008 and the
.NET 3.5 Platform
COM and .NET
Interoperability
Expert ASP.NET 2.0
Advanced Application
Design
Developer’s Workshop
to COM and ATL 3.0

Free Companion eBook

THE APRESS ROADMAP
Beginning C# 2008

Pro ASP.NET 3.5


in C# 2008
Pro LINQ

For a limited time only.
See last page for details.

Accelerated C# 2008

Pro C# 2008 and the
.NET 3.5 Platform

Beginning C# 2008
Databases

Pro VB 2008 and the
.NET 3.5 Platform

Pro WPF in C# 2008

SOURCE CODE ONLINE

www.apress.com

ISBN-13: 978-1-59059-884-9
ISBN-10: 1-59059-884-9
55999

US $59.99
Shelve in
Programming/

Microsoft/.NET
User level:
Intermediate–Advanced

and the

.NET 3.5

Andrew Troelsen
Microsoft MVP, Visual Developer—Visual C#

2008

Platform

Take care and enjoy,

Pro

C#

Author of

The first edition of this book was released at the 2001 Tech·Ed conference in
Atlanta, Georgia. (I honestly can’t believe it was that long ago!) Since that time,
this text has been revised, tweaked, and enhanced to account for the changes
found within each release of the .NET platform (1.1, 2.0, 3.0, and now 3.5).
.NET 3.0 was more of an augmentative release, essentially providing three new
APIs: Windows Presentation Foundation (WPF), Windows Communication
Foundation (WCF), and Windows Workflow Foundation (WF). As you would

expect, coverage of the “W’s” has been expanded upon a great deal from the
previous Special Edition of this text.
Unlike .NET 3.0, .NET 3.5 provides dozens of new C# language features and .NET
APIs. This edition of the book will walk you through all of this new material using
the same readable approach (at least that is what I have been told!) as found
in the prior editions. Rest assured, you’ll find detailed coverage of Language
Integrated Query (LINQ), the C# 2008 language changes (automatic properties,
extension methods, anonymous types, etc.), and the numerous bells and whistles
of Visual Studio 2008.
If you’re checking out this book for the first time, understand that it targets
experienced software professionals and/or students of computer science (so
please don’t expect three chapters devoted to “for loops”). The mission of this
text is to provide you with a rock-solid foundation in the C# 2008 programming
language and the core aspects of the .NET platform (OOP, assemblies, file IO,
Windows Forms/WPF, ASP.NET, ADO.NET, WCF, WF, etc.). Once you digest the
information presented in these 33 chapters, you’ll be in a perfect position to
apply this knowledge to your specific programming assignments, and you’ll be
well equipped to explore the .NET universe on your own terms.

For a limited time,
get the free, fully searchable
eBook—a $30 value!

Fourth Edition

See
See last
last page
page for
for details.

details.
Offer
Offer ends
ends June
June 30,
30, 2008.
2008.

Pro

C# 2008

and
the

.NET 3.5 Platform
Exploring the .NET universe using curly brackets

Fourth Edition

Andrew Troelsen

Troelsen

9 781590 598849

this print for content only—size & color not accurate

7" x 9-1/4" / CASEBOUND / MALLOY




8849FM.qxd

10/19/07

9:45 AM

Page i

Pro C# 2008 and the
.NET 3.5 Platform
Fourth Edition

Andrew Troelsen


8849FM.qxd

10/19/07

9:45 AM

Page ii

Pro C# 2008 and the .NET 3.5 Platform, Fourth Edition
Copyright © 2007 by Andrew Troelsen
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.

ISBN-13: 978-1-59059-884-9
ISBN-10: 1-59059-884-9
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Lead Editor: Ewan Buckingham
Technical Reviewer: Gavin Smyth
Editorial Board: Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick,
Jason Gilmore, Kevin Goff, Jonathan Hassell, Matthew Moodie, Joseph Ottinger, Jeffrey Pepper,
Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh
Production Director | Project Manager: Grace Wong
Senior Copy Editors: Ami Knox, Nicole Flores
Associate Production Director: Kari Brooks-Copony
Production Editor: Ellie Fountain
Compositor: Dina Quan
Proofreaders: April Eddy and Liz Welch
Indexer: Broccoli Information Management
Artist: Kinetic Publishing Services, LLC
Cover Designer: Kurt Krames
Manufacturing Director: Tom Debolski
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail ,
or visit .
For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600,
Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail , or visit
.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any
liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly
or indirectly by the information contained in this work.

The source code for this book is available to readers at in the Source Code/
Download section. You will need to answer questions pertaining to this book in order to successfully
download the code.


8849FM.qxd

10/19/07

9:45 AM

Page iii

This edition of the text is dedicated to Mikko the wonder cat, life at 412, and my wonderful
wife, Amanda, who patiently waited for me to finish yet another book.


8849INDEX.qxd

10/18/07

5:51 PM

Page 1369

■INDEX

WindowHeight property, 76
WindowLeft property, 76
<Window.Resources> element, 1149

Windows collection, 1016
Windows Communication Foundation (WCF), 867
Window’s constructor, 1060
Windows Distributed interNet Applications
Architecture (DNA) deficiencies, 5–6
Windows Forms, 556–557, 999
Windows Presentation Foundation (WPF), 955,
1318. See also Application type; Window
object
assemblies
overview, 1005
role of Application class, 1006
role of Window class, 1006–1011
building WPF applications using Visual Studio
2008, 1044–1048
building XAML-free WPF applications
creating simple user interface, 1013–1015,
1021
extending Window class type, 1013
overview, 1011–1013
controlling content layout using panels, 1108
Extensible Application Markup Language
(XAML)
attached properties, 1038–1039
Browser Applications (XBAPs), 1004
defining application object in, 1023, 1033
defining MainWindow in, 1022–1023
elements and attributes, 1035
experimenting with using XamlPad, 1032
markup extensions, 1039–1041

overview, 1021–1022
processing at runtime, 1048–1052
processing XAML files via msbuild.exe,
1023–1024
property-element syntax, 1036–1037
type converters, 1039
motivation behind
overview, 999–1000
providing optimized rendering model, 1001
providing separation of concerns via XAML,
1001
separation of concerns using code-behind files,
1029–1030
transforming markup into .NET assembly
mapping XAML to C# code, 1025–1026
overview, 1025
role of Binary Application Markup Language
(BAML), 1026–1028
XAML-to-assembly process summary,
1028–1029, 1052
Windows property, Application type, 1006
Windows Vista operating system, 1001
Windows Workflow Foundation (WF)
assemblies and core namespaces, 924
brief word regarding custom activities, 951–952

Find it faster at />
WcfTestClient.exe application, 915
web applications in ASP.NET, 1203–1204, 1207
web controls in ASP.NET, 1207–1209

web enhancements, .NET 3.5, 1178
web page code model, ASP.NET, 1179, 1181
web paradigm, 1177
web parts, 1178
Web Service Description Language (WSDL), 895
Web Services Enhancements (WSE) 3.0, 873
Web Site template, 1190
web-centric primer, 1177
Web.config, ASP.NET, 1204, 1269–1270
Web.config file, 878, 913–914, 1163, 1178, 1188,
1191, 1203–1204, 1271–1272, 1274
WebControl class properties, ASP.NET, 1213
WebDev.WebServer.exe utility, 1166–1167, 1178,
1183
WebMethod attribute, 543, 870
WebService directive, 871
WebServiceFaultActivity, WF, 921
WebServiceInputActivity, WF, 921
WebServiceOutputActivity, WF, 921
website administration utility, ASP.NET, 1205–1206
website directory structure, ASP.NET, 1190
Web.sitemap file, 1219
where keyword, generics, 335
Where( ) method, 461
where operator, 463, 466
Where<T>( ) method, 461
While activity, 928–930
while loop, 101, 795
WhileActivity, WF, 921
widening, 95

widgets, 1169, 1248
Width member, 1061
Width property, 1085, 1137, 1213
Width value, 1087
Win 32 binaries (*.dll or *.exe), 11
Win32 file header in assemblies, 482
Window class
overview, 1006–1007
System.Windows.Controls.ContentControl base
class, 1007–1008
System.Windows.Controls.Control base class,
1008–1009
System.Windows.DependencyObject base class,
1010
System.Windows.Media.Visual base class, 1010
System.Windows.Threading.DispatcherObject
base class, 1011
System.Windows.UIElement base class, 1010
Window object
closing of, 1018–1019
lifetime of, 1017–1018
Window type, 1083, 1094, 1103, 1113, 1118
<Window> element, 1022, 1032, 1084, 1113, 1154
Window1 type, 1108
Window-derived type, 1121

1369


8849INDEX.qxd


1370

10/18/07

5:51 PM

Page 1370

■INDEX

building blocks of
getting into flow of workflow, 925–926
integrated services of WF, 919
overview, 918–919
role of sequential workflows and state
machine workflows, 921–923
WF activities, 920–921
building reusable code library, 948–951
building simple workflow-enabled application
adding Code activity, 927–928
adding custom start-up parameters, 931–935
adding While activity, 928–930
initial workflow code, 926–927
overview, 926
WF engine hosting code, 930–931
invoking web services within workflows,
934–935
motivation behind, 917–918
overview, 917

Windows Workflow toolbox, 920
Windows XP Home Edition and ASP.NET,
1166–1167
WindowsBase.dll assembly, WPF, 1005
Windows.Forms coding, 977
WindowsFormsDataTableViewer application, 799
WindowState property, 972
WindowTop property, 76
WindowWidth property, 76
WinFormsClientApp.cs file, 1328
Wizard definition, 1229
Wizard web control, 1228
worker thread, 562
WorkflowCompleted event, WorkflowRuntime, 931
workflow-enabled application, 918
WorkflowInstance core type, 930
WorkflowRuntime core type, 930
WorkflowTerminated event, WorkflowRuntime, 931
WrapPanel control, 1056, 1085, 1088
<WrapPanel> element, 1114
Write( ) method, 676, 678, 682, 1189, 1199
WriteAllBytes( ) method, 674
WriteAllLines( ) method, 674
WriteAllText( ) method, 674
WriteFile( ) method, 70, 153, 678, 1199
write-only class properties, 171
WriteOnly keyword, 165, 171
write-only property, 171
WriteTextToIsoStorage( ) method, 707
WriteXml( ) method, 796

WriteXmlSchema( ) method, 796
writing to a text file, 679
wsdl utility, 1322
wsdl.exe command-line tool, 872
WSDualHttpBinding class, 882
WSDualHttpBinding option, 881
WSFederationHttpBinding class, 882

WSFederationHttpBinding option, 881
WSHttpBinding class, 905
WSHttpBinding option, 881
WSHttpBinding protocol, 882, 901

X
X or x string format, .NET, 78
X property, 976
*.xaml file, 1024, 1028, 1055, 1129
XamlPad, 1031–1032
XAttribute member, 859
XAttributes object, 859
x/COL/Type markup extension, 1151
XComment member, 859
Xcopy deployment, 499
XDeclaration member, 859
XDocument member, 859
XDocument type, 860
XElement member, 858
XElement parameter, 864
XElement type, 860
XElement.Descendants( ) method, 863

XElement.Load( ) method, 863
XElements object, 859
XML
and ADO.NET, 731
/doc compiler flag, 179
documentation elements, 177
documenting VB 2005 source code via, 176–180
source code documentation, 176–177
*.xml file, 179, 1114
XmlDataProvider type, 1114
XmlElement type, 1115
xmlns attribute, 1168
XmlReader/XmlWriter models, 858
XmlSerializer, 716, 720–722
XName/XNamespace member, 859
XPath bindings, 1114
xPos member variable, 437
xsd utility, 1322
xsp2 utility, 1322

Y
y operators, 448
Y property, 976
yetAnotherPoint variable, 437
yield keyword, 292–293
yPos member variable, 437




×