APress - C# And .Net Platform (2003).pdf

(21905 KB) Pobierz
C# and the .NET Platform, Second Edition
C# and the .NET Platform, Second Edition
by Andrew Troelsen
ISBN:1590590554
Apress © 2003 (1200 pages)
This comprehensive text starts with a brief overview of the
C# language and then quickly moves to key technical and
architectural issues for .NET developers.
Table of Contents
C# and the .NET Platform, Second Edition
Introduction
Part One - Introducing C# and the .NET Platform
Chapter 1 - The Philosophy of .NET
Chapter 2 - Building C# Applications
Part Two - The C# Programming Language
Chapter 3 - C# Language Fundamentals
Chapter 4 - Object-Oriented Programming with C#
Chapter 5 - Exceptions and Object Lifetime
Chapter 6 - Interfaces and Collections
Chapter 7 - Callback Interfaces, Delegates, and Events
Chapter 8 - Advanced C# Type Construction Techniques
Part Three - Programming with .NET Assemblies
Chapter 9 - Understanding .NET Assemblies
Chapter 10 - Processes, AppDomains, Contexts, and Threads
Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming
Part Four - Leveraging the .NET Libraries
Chapter 12 - Object Serialization and the .NET Remoting Layer
Chapter 13 - Building a Better Window (Introducing Windows Forms)
Chapter 14 - A Better Painting Framework (GDI+)
Chapter 15 - Programming with Windows Forms Controls
Chapter 16 - The System.IO Namespace
Chapter 17 - Data Access with ADO.NET
Part Five - Web Applications and XML Web Services
Chapter 18 - ASP.NET Web Pages and Web Controls
Chapter 19 - ASP.NET Web Applications
Chapter 20 - XML Web Services
Index
List of Figures
List of Tables
30348303.025.png 30348303.026.png 30348303.027.png 30348303.028.png
Back Cover
C# and the .NET Platform, Second Edition starts with a brief overview of the C# language and then quickly moves
to key technical and architectural issues for .NET developers. Not only is there extensive coverage of the .NET
Framework, but Andrew Troelsen also shows programmers what they need to know about such necessary, but
subtle, areas as the proper use of threads and how to leverage the new .NET remoting protocol. Readers will also
see how to use C# for GUI applications with a complete discussion of Windows Forms, custom controls, and GDI+.
ISBN:1590590554
Apress © 2003 (1200 pages)
This comprehensive text starts with a brief overview of the
C# language and then quickly moves to key technical and
architectural issues for .NET developers.
Table of Contents
C# and the .NET Platform, Second Edition
Introduction
Part One - Introducing C# and the .NET Platform
Chapter 1 - The Philosophy of .NET
Chapter 2 - Building C# Applications
Part Two - The C# Programming Language
Chapter 3 - C# Language Fundamentals
Chapter 4 - Object-Oriented Programming with C#
Chapter 5 - Exceptions and Object Lifetime
Chapter 6 - Interfaces and Collections
Chapter 7 - Callback Interfaces, Delegates, and Events
Chapter 8 - Advanced C# Type Construction Techniques
Part Three - Programming with .NET Assemblies
Chapter 9 - Understanding .NET Assemblies
Chapter 10 - Processes, AppDomains, Contexts, and Threads
Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming
Part Four - Leveraging the .NET Libraries
Chapter 12 - Object Serialization and the .NET Remoting Layer
Chapter 13 - Building a Better Window (Introducing Windows Forms)
Chapter 14 - A Better Painting Framework (GDI+)
Chapter 15 - Programming with Windows Forms Controls
Chapter 16 - The System.IO Namespace
Chapter 17 - Data Access with ADO.NET
Part Five - Web Applications and XML Web Services
Chapter 18 - ASP.NET Web Pages and Web Controls
Chapter 19 - ASP.NET Web Applications
Chapter 20 - XML Web Services
Index
List of Figures
List of Tables
About the Author
Andrew Troelsen is a partner, trainer, and consultant at Intertech-Inc., a .NET and J2EE developer education center
(http://www.intertech-inc.com). He is a leading authority on both .NET and COM. His earlier five-star treatment of
traditional COM in the best-selling Developer's Workshop to COM and ATL 3.0 is mirrored in his latest book, COM
and .NET Interoperability, and his award-winning treatment of C# in C# and the .NET Platform , as well as his five-
star investigation of VB .NET in Visual Basic .NET and the .NET Platform: An Advanced Guide . He has a degree in
mathematical linguistics and South Asian studies from the University of Minnesota and is a frequent speaker at
numerous .NET-related conferences.
C# and the .NET Platform, Second Edition
by Andrew Troelsen
There are equally useful discussions on how to use C# and .NET for Web development, Web services, and data
access using ADO.NET. From Windows-based to Web-based applications, it's all here. There are detailed discussions
of every aspect of .NET development and useful examples with no toy code.
30348303.001.png 30348303.002.png 30348303.003.png 30348303.004.png 30348303.005.png 30348303.006.png
C# and the .NET Platform, Second Edition
ANDREW TROELSEN
ISBN:1590590554
Apress © 2003 (1200 pages)
This comprehensive text starts with a brief overview of the
C# language and then quickly moves to key technical and
architectural issues for .NET developers.
Table of Contents
C# and the .NET Platform, Second Edition
Introduction
Part One - Introducing C# and the .NET Platform
Chapter 1 - The Philosophy of .NET
Chapter 2 - Building C# Applications
Part Two - The C# Programming Language
Chapter 3 - C# Language Fundamentals
Chapter 4 - Object-Oriented Programming with C#
Chapter 5 - Exceptions and Object Lifetime
Chapter 6 - Interfaces and Collections
Chapter 7 - Callback Interfaces, Delegates, and Events
Chapter 8 - Advanced C# Type Construction Techniques
Part Three - Programming with .NET Assemblies
Chapter 9 - Understanding .NET Assemblies
Chapter 10 - Processes, AppDomains, Contexts, and Threads
Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming
Part Four - Leveraging the .NET Libraries
Chapter 12 - Object Serialization and the .NET Remoting Layer
Chapter 13 - Building a Better Window (Introducing Windows Forms)
Chapter 14 - A Better Painting Framework (GDI+)
Chapter 15 - Programming with Windows Forms Controls
Chapter 16 - The System.IO Namespace
Chapter 17 - Data Access with ADO.NET
Part Five - Web Applications and XML Web Services
Chapter 18 - ASP.NET Web Pages and Web Controls
Chapter 19 - ASP.NET Web Applications
Chapter 20 - XML Web Services
Index
List of Figures
List of Tables
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: 1-59059-055-4
Printed and bound in the United States of America 12345678910
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.
Technical Reviewers: Gregory A. Beamer, Gary Cornell, Eric Gunnerson, Joe Nalewabau, Kent
Sharkey, Nick Symmonds, Pradeep Tapadiya
Editorial Directors: Dan Appleman, Gary Cornell, Simon Hayes, Martin Streicher, Karen Watterson, John
Zukowski
Assistant Publisher: Grace Wong
Copy Editors: Anne Friedman and Ami Knox
Proofreader: Liz Berry
Production Goddess: Susan Glinert Stevens
Indexer: Ron Strauss
Artist and Cover Designer: Kurt Krames
Manufacturing Manager: Tom Debolski
Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 175 Fifth Avenue,
New York, NY, 10010 and outside the United States by Springer-Verlag GmbH & Co. KG, Tiergartenstr.
17, 69112 Heidelberg, Germany.
In the United States: phone 1-800-SPRINGER, email < orders@springer-ny.com >, or visit
http://www.springer-ny.com . Outside the United States: fax +49 6221 345229, email
< orders@springer.de >, or visit http://www.springer.de .
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley,
CA 94710. Phone 510-549-5930, fax 510-549-5939, email < info@apress.com >, 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.
C# and the .NET Platform, Second Edition
by Andrew Troelsen
Copyright © 2003 by Andrew Troelsen
30348303.007.png 30348303.008.png 30348303.009.png 30348303.010.png 30348303.011.png 30348303.012.png 30348303.013.png
The source code for this book is available to readers at http://www.apress.com in the Downloads
section.
C# and the .NET Platform, Second Edition
by Andrew Troelsen
ISBN:1590590554
I would like to dedicate this book to my father, Wally Troelsen. Thanks, Dad, for all of your support over
the years and the years to com e.
Apress © 2003 (1200 pages)
This comprehensive text starts with a brief overview of the
C# language and then quickly moves to key technical and
architectural issues for .NET developers.
Luv ya,
Damn Kid
Table of Contents
C# and the .NET Platform, Second Edition
Introduction
Part One - Introducing C# and the .NET Platform
Chapter 1 - The Philosophy of .NET
Chapter 2 - Building C# Applications
Part Two - The C# Programming Language
Chapter 3 - C# Language Fundamentals
Chapter 4 - Object-Oriented Programming with C#
Chapter 5 - Exceptions and Object Lifetime
Chapter 6 - Interfaces and Collections
Chapter 7 - Callback Interfaces, Delegates, and Events
Chapter 8 - Advanced C# Type Construction Techniques
Part Three - Programming with .NET Assemblies
Chapter 9 - Understanding .NET Assemblies
Chapter 10 - Processes, AppDomains, Contexts, and Threads
Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming
Part Four - Leveraging the .NET Libraries
Chapter 12 - Object Serialization and the .NET Remoting Layer
Chapter 13 - Building a Better Window (Introducing Windows Forms)
Chapter 14 - A Better Painting Framework (GDI+)
Chapter 15 - Programming with Windows Forms Controls
Chapter 16 - The System.IO Namespace
Chapter 17 - Data Access with ADO.NET
Part Five - Web Applications and XML Web Services
Chapter 18 - ASP.NET Web Pages and Web Controls
Chapter 19 - ASP.NET Web Applications
Chapter 20 - XML Web Services
Index
List of Figures
List of Tables
Andrew Troelsen is a partner, trainer, and consultant at Intertech-Inc., a .NET and J2EE developer
education center ( http://www.intertech-inc.com ) . He is a leading authority on both .NET and
COM. His earlier five-star treatment of traditional COM in the best-selling Developer's Workshop to COM
and ATL 3.0 is mirrored in his latest book, COM and .NET Interoperability , and his award-winning
treatment of C# in C# and the .NET Platform , as well as his five-star investigation of VB .NET in Visual
Basic .NET and the .NET Platform: An Advanced Guide . He has a degree in mathematical linguistics and
South Asian studies from the University of Minnesota and is a frequent speaker at numerous .NET-related
conferences.
He currently lives in Minneapolis, Minnesota, with his wife Amanda, and spends his free time investigating
.NET and waiting for the Wild to win the Stanley Cup, the Vikings to win the Super Bowl (before he retires
would be nice), and the Timberwolves to grab numerous NBA championship titles.
Acknowledgments
Completing the second edition of C# and the .NET Platform would have been completely impossible
without the assistance and talent offered by numerous individuals. First of all, many thanks to my copy
editors, Anne Friedman and Ami Knox. Both of you, as always, did an outstanding job massaging my raw
manuscript into a polished product. (See you both on the nextbook?) Next, I must thank the numerous
technical reviewers who took the time to read these chapters for any coding faux pas: Gregory A. Beamer,
Gary Cornell, Eric Gunnerson, Joe Nalewabau, Kent Sharkey, Nick Symmonds, and Pradeep Tapadiya.
Special thanks to Beth Christmas, Ron Strauss, Susan Glinert Stevens, and Liz Berry, whose combined
efforts formatted, indexed, and finalized this text to completion. Of course, any remaining errors (spelling,
coding, or otherwise) that may have snuck into this book are my sole responsibility.
I also must say a huge thanks to all of those at Apress who have made a publishing company that is a
pleasure to work with. Thanks to Hollie Fisher (for many things), Doris Wong (for many more things), and
Grace Wong, my chaka friend, for not totally blasting me into pieces when I abused the phrase "I'll get it to
you today" one too many times.
Thanks to my friends and family who (once again) tolerated my lack of time and sometimes grumpy
demeanor. More thanks to my friends at Intertech-Inc. (not Tom Salonek, who I still don't like much). Your
support (directly and indirectly) is greatly appreciated. Finally, thanks to my wife Mandy and "all the kids"
for their love and encouragement.
About the Author
30348303.014.png 30348303.015.png 30348303.016.png 30348303.017.png 30348303.018.png 30348303.019.png
C# and the .NET Platform, Second Edition
by Andrew Troelsen
ISBN:1590590554
I remember a time years ago when I proposed a book to Apress regarding a forthcoming software SDK
named Next Generation Windows Services (NGWS). As you may already know, NGWS eventually
became what we now know as the .NET platform. My research of the C# programming language and the
.NET platform took place in parallel with the authoring of the text. It was a fantastic project; however, I
must confess that it was more than a bit nerve-wracking writing about a technology that was undergoing
drastic changes over the course of its development. It pains me to recall how many chapters had to be
completely destroyed and rewritten during that time. Thankfully, after many sleepless nights, the first
edition of C# and the .NET Platform was published in con-junction with the release of .NET Beta 2, circa
the summer of 2001.
Table of Contents
C# and the .NET Platform, Second Edition
Introduction
Part One - Introducing C# and the .NET Platform
Chapter 1 - The Philosophy of .NET
Chapter 2 - Building C# Applications
Part Two - The C# Programming Language
Chapter 3 - C# Language Fundamentals
Chapter 4 - Object-Oriented Programming with C#
Chapter 5 - Exceptions and Object Lifetime
Chapter 6 - Interfaces and Collections
Chapter 7 - Callback Interfaces, Delegates, and Events
Chapter 8 - Advanced C# Type Construction Techniques
Part Three - Programming with .NET Assemblies
Chapter 9 - Understanding .NET Assemblies
Chapter 10 - Processes, AppDomains, Contexts, and Threads
Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming
Part Four - Leveraging the .NET Libraries
Chapter 12 - Object Serialization and the .NET Remoting Layer
Chapter 13 - Building a Better Window (Introducing Windows Forms)
Chapter 14 - A Better Painting Framework (GDI+)
Chapter 15 - Programming with Windows Forms Controls
Chapter 16 - The System.IO Namespace
Chapter 17 - Data Access with ADO.NET
Part Five - Web Applications and XML Web Services
Chapter 18 - ASP.NET Web Pages and Web Controls
Chapter 19 - ASP.NET Web Applications
Chapter 20 - XML Web Services
Index
List of Figures
List of Tables
Since that point, I have been extremely happy and grateful to see that the first edition of this text was very
well received by the press and, most importantly, the readers. Over the years, it was nominated as a Jolt
award finalist (I lost ... crap!) as well as the 2003 Referenceware programming book of the year (I won ...
cool!). Although the first edition of this book has enjoyed a good run, it became clear that a second edition
was in order—not only to account for the changes brought about with the minor release of the .NET
platform, but to expand upon and improve the existing content. As I write this frontmatter, version 1.1 of the
.NET platform is just about official, and I am happy to say that C# and the .NET Platform, Second Edition is
being released in tandem.
As in the first edition, this second edition presents the C# programming language and .NET base class
libraries using a friendly and approachable tone. I have never under-stood the need some technical
authors have to spit out prose that reads more like a GRE vocabulary study guide than a readable
discourse. As well, this new edition remains focused on providing you with the information you need to
build software solutions today, rather than spending too much time focusing on esoteric details that few
individuals will ever actually care about. To this end, when I do dive under the hood and check out some
more low-level functionality of the CLR (or blocks of CIL code), I promise it will prove enlightening (rather
than simple eye candy).
We 're a Team, You and I
Technology authors write for a demanding group of people (I should know, I'm one of them). You know
that building software solutions using any platform is extremely detailed and is very specific to your
department, company, client base, and subject matter. Perhaps you work in the electronic publishing
industry, develop systems for the state or local government, work at NASA or a branch of the military.
Speaking for myself, I have developed children's educational software, various n-tier systems, as well as
numerous projects within the medical and financial world. The chances are almost 100 percent that the
code you write at your place of employment has little to do with the code I write at mine (unless we
happened to work together previously! ).
Therefore, in this book, I have deliberately chosen to avoid creating examples that tie the example code to
a specific industry or vein of programming. Rather, I choose to explain C#, OOP, the CLR, and the .NET
base class libraries using industry-agnostic examples. Rather than having every blessed example fill a grid
with data, calculate payroll, or whatnot, I'll stick to subject matter we can all relate to: automobiles (with
some geometric structures and employees thrown in for good measure). And that's where you come in.
My job is to explain the C# programming language and the core aspects of the .NET platform the best I
possibly can. As well, I will do everything I can to equip you with the tools and strategies you need to
continue your studies at this book's conclusion. Your job is to take this information and apply it to your
specific programming assignments.
I obviously understand that your projects most likely don't revolve around automobiles with pet names;
however, that's what applied knowledge is all about! Rest assured, once you understand the concepts
presented within this text, you will be in a perfect position to build .NET solutions that map to your own
unique programming environment.
Introduction
Apress © 2003 (1200 pages)
This comprehensive text starts with a brief overview of the
C# language and then quickly moves to key technical and
architectural issues for .NET developers.
30348303.020.png 30348303.021.png 30348303.022.png 30348303.023.png 30348303.024.png
Zgłoś jeśli naruszono regulamin