ebook img

C# and the .NET Platform - Andrew Troelsen PDF

1187 Pages·2004·21.39 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview C# and the .NET Platform - Andrew Troelsen

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 C# and the .NET Platform, Second Edition Back Cover by Andrew Troelsen ISBN:1590590554 C# and the .NET Platform, Second Edition starts with a brief overview of the C# language and then quickly moves Apress © 2003 (1200 pages) to key technical and architectural issues for .NET developers. Not only is there extensive coverage of the .NET Framework, but AndTrheiws cTormoeplsreehne anlssiov es htoewxts sptarortgsr awmitmh ear sb rwiehf aotv tehrevyie nwe eodf tthoe know about such necessary, but subtle, areas as the Cp#ro lpaenrg uusaeg eo fa tnhdr ethadesn aqnudic khloyw m toov leesv etora kgeey t hteec nhenwic a.lN aEnTd remoting protocol. Readers will also see how to use C# faorrc hGiUteIc atuprpalilc iastsiuoenss fwoirt h.N aE Tco dmepvleelotep edrissc.ussion of Windows Forms, custom controls, and GDI+. 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 Table of Contents of every aspect of .NET development and useful examples with no toy code. C# and the .NET Platform, Second Edition Introduction About the Author Part One - Introducing C# and the .NET Platform Andrew Troelsen is a partner, trainer, and consultant at Intertech-Inc., a .NET and J2EE developer education center Chapter 1 - The Philosophy of .NET (http://www.intertech-inc.com). He is a leading authority on both .NET and COM. His earlier five-star treatment of Chapter 2 - Building C# Applications traditional COM in the best-selling Developer's Workshop to COM and ATL 3.0 is mirrored in his latest book, COM aPnadr t. NTEwTo I -n tTehreo pCe#ra Pbriloitgyr,a amnmd ihnigs Laawnagrdu-awgienning treatment of C# in C# and the .NET Platform, as well as his five- sCtahra ipntveer s3tiga-tiCon# oLfa VnBgu .aNgEeT Finu nVdisaumael nBtaaslsic .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 Chapter 4 - Object-Oriented Programming with C# numerous .NET-related conferences. 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 C# and thC#e a n.dN thEe .TNE TP Pllaatftorfmo, rSemco,n dS Edeiticonond Edition by Andrew Troelsen ISBN:1590590554 ANDREW TROELSEN 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 CC# oapnydr igthhet .©N E2T0 0P3la tbfyo rAmn,d Sreecwo nTdr oEedlisteionn Introduction Part One - Introducing C# and the .NET Platform All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, Chapter 1 - The Philosophy of .NET electronic or mechanical, including photocopying, recording, or by any information storage or retrieval Cshyasptteemr 2, wi-thBouuitl dtihneg pCr#io rA wpprliitcteanti opnesrmission of the copyright owner and the publisher. PIaSrtB TNw: o1 --5 T9h0e5 9C#-0 5P5ro-4gramming Language Chapter 3 - C# Language Fundamentals CPharipntteerd 4 an-d Obbojuencdt- Oinr itehnet eUdn Pitreodg rSatmatmeisn go fw Aitmh eCr#ica 12345678910 Chapter 5 - Exceptions and Object Lifetime Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence Chapter 6 - Interfaces and Collections of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark Chapter 7 - Callback Interfaces, Delegates, and Events owner, with no intention of infringement of the trademark. Chapter 8 - Advanced C# Type Construction Techniques PTaretc Thhnreicea -l PRreovgireawmemrisn:g G wreitgho .rNyE AT. A Bsesaemmbelri,e sGary Cornell, Eric Gunnerson, Joe Nalewabau, Kent CShahpatrekre 9y, N-icUkn dSeyrmstmanodnindgs ,. NPEraT dAesespem Tbalpieasdiya Chapter 10 - Processes, AppDomains, Contexts, and Threads Editorial Directors: Dan Appleman, Gary Cornell, Simon Hayes, Martin Streicher, Karen Watterson, John Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming Zukowski Part Four - Leveraging the .NET Libraries Chapter 12 - Object Serialization and the .NET Remoting Layer Assistant Publisher: Grace Wong Chapter 13 - Building a Better Window (Introducing Windows Forms) CChaoppteyr E 1d4it-orAs B: eAtntenre P Fairnietidnmg aFrna amnedw Aormk i( KGDnoI+x) Chapter 15 - Programming with Windows Forms Controls Proofreader: Liz Berry Chapter 16 - The System.IO Namespace Chapter 17 - Data Access with ADO.NET Production Goddess: Susan Glinert Stevens Part Five - Web Applications and XML Web Services CIhnadpetexre 1r:8 R-oAnS SP.tNraEuTs sWeb Pages and Web Controls Chapter 19 - ASP.NET Web Applications Artist and Cover Designer: Kurt Krames Chapter 20 - XML Web Services Index Manufacturing Manager: Tom Debolski List of Figures LiDsti sotrf ibTuabteleds 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 <[email protected]>, or visit http://www.springer-ny.com. Outside the United States: fax +49 6221 345229, email <[email protected]>, 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 <[email protected]>, or visit http://www.apress.com. 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 http://www.apress.com in the Downloads C# and the .NET Platform, Second Edition section. by Andrew Troelsen ISBN:1590590554 I would like to dedAipcraetses t©h i2s0 0b3o (o1k20 t0o p amgyes )father, Wally Troelsen. Thanks, Dad, for all of your support over the years and theT yheisa crosm top rceohmen es.ive text starts with a brief overview of the C# language and then quickly moves to key technical and Luv ya, architectural issues for .NET developers. Damn Kid TaAbbleo ouft Cthoen tAeuntthsor C# and the .NET Platform, Second Edition Andrew Troelsen is a partner, trainer, and consultant at Intertech-Inc., a .NET and J2EE developer Introduction education center (http://www.intertech-inc.com). He is a leading authority on both .NET and Part One - Introducing C# and the .NET Platform COM. His earlier five-star treatment of traditional COM in the best-selling Developer's Workshop to COM Chapter 1 - The Philosophy of .NET and ATL 3.0 is mirrored in his latest book, COM and .NET Interoperability, and his award-winning Chapter 2 - Building C# Applications treatment of C# in C# and the .NET Platform, as well as his five-star investigation of VB .NET in Visual Part Two - The C# Programming Language Basic .NET and the .NET Platform: An Advanced Guide. He has a degree in mathematical linguistics and Chapter 3 - C# Language Fundamentals South Asian studies from the University of Minnesota and is a frequent speaker at numerous .NET-related Cchoanptfeerr e4nce-sO.bject-Oriented Programming with C# Chapter 5 - Exceptions and Object Lifetime CHhaep cteurr r6ent-lyI nlivteersf aince Ms iannnde aCpololelicst,i oMnisnnesota, with his wife Amanda, and spends his free time investigating C.hNaEptTe ra 7nd w- aCiatilnlbga cfokr Itnhtee rWfacileds t,o D welieng tahtee sS, taanndle Eyv Cenutps, the Vikings to win the Super Bowl (before he retires would be nice), and the Timberwolves to grab numerous NBA championship titles. Chapter 8 - Advanced C# Type Construction Techniques Part Three - Programming with .NET Assemblies Acknowledgments Chapter 9 - Understanding .NET Assemblies CChaopmteprl e1t0in-g Pthroec seessceosn, dA pepdDitioomn aoinf sC, #C aonntde xthtse, .aNnEd TT hPrleaatdfosrm would have been completely impossible Cwhaitphtoeur t1 t1he- aTsyspiest aRnefcleec atinond, taLaleten tB oinffdeinregd, abnyd n Autmtriebruotue-sB inasdeivdi dPuroaglsr.a Fmirmstin ogf all, many thanks to my copy Peardti tFoorsu,r A- nLneeve Frarigeidnmg athne a .nNdE TA Lmibi rKanrioexs. Both of you, as always, did an outstanding job massaging my raw Cmhaapnteurs c1r2ip-t iOnbtoje ac tp Soelirsiahleizda tpiorond auncdt .t (hSee .eN EyTo uR ebmotoht ionng tLhaey enrextbook?) Next, I must thank the numerous Ctheacphtneric 1a3l r-evBieuiwldeinrsg wa hBoe tttoeork W thined otimw e(I ntot rroedaudc itnhge Wsei ncdhoawpst eFrosr mfosr) any coding faux pas: Gregory A. Beamer, CGhaaprtye rC 1o4rn-elAl, BEeritcte Gr uPaninnetirnsgo nFr, aJmoeew Noarkle (wGaDbIa+u), Kent Sharkey, Nick Symmonds, and Pradeep Tapadiya. CShappetceira l1 t5ha-nPkrso gtora Bmemthin Cgh wriisthtm Waisn,d Rowons FSotrramuss Cs,o Sntursoalsn Glinert Stevens, and Liz Berry, whose combined efforts formatted, indexed, and finalized this text to completion. Of course, any remaining errors (spelling, Chapter 16 - The System.IO Namespace coding, or otherwise) that may have snuck into this book are my sole responsibility. Chapter 17 - Data Access with ADO.NET Part Five - Web Applications and XML Web Services I also must say a huge thanks to all of those at Apress who have made a publishing company that is a Chapter 18 - ASP.NET Web Pages and Web Controls pleasure to work with. Thanks to Hollie Fisher (for many things), Doris Wong (for many more things), and Chapter 19 - ASP.NET Web Applications Grace Wong, my chaka friend, for not totally blasting me into pieces when I abused the phrase "I'll get it to Cyhoaupt teord 2a0y"- oXnMeL t oWoe mb aSenryv tiicmeses. Index LiTsth aofn kFisg utor emsy friends and family who (once again) tolerated my lack of time and sometimes grumpy Lidset mofe Taanbolers. 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. IntroductCi#o annd the .NET Platform, Second Edition by Andrew Troelsen ISBN:1590590554 I remember a timAep yreesasr s© a20g0o3 w(1h20e0n p aI gperso)posed a book to Apress regarding a forthcoming software SDK named Next GenTehraist ioconm Wprinedheonwssiv Se etrevxict estsa (rNtsG wWithS )a. bArsie yf oouv emrvaieyw a loref athdey know, NGWS eventually C# language and then quickly moves to key technical and became what we now know as the .NET platform. My research of the C# programming language and the architectural issues for .NET developers. .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 Table of Contents completely destroyed and rewritten during that time. Thankfully, after many sleepless nights, the first C# and the .NET Platform, Second Edition edition of C# and the .NET Platform was published in con-junction with the release of .NET Beta 2, circa Introduction the summer of 2001. Part One - Introducing C# and the .NET Platform CShainpcteer t h1at -poThinet , PIh hilaovseop bheye onf e.NxtEreTmely happy and grateful to see that the first edition of this text was very Cwhaepllt erer c2eiv-edB ubilyd tinhge Cp#re Assp palincda,t imonosst importantly, the readers. Over the years, it was nominated as a Jolt Paarwt aTrwd ofi n- aTlhiset C(I# lo Psrto .g..r acmramp!i)n ag sL awnegllu aags ethe 2003 Referenceware programming book of the year (I won ... Cchoaoptl!e)r. 3Alth-oCu#gh L athneg ufiarsgte e Fduintiodnam oef nthtaisls book has enjoyed a good run, it became clear that a second edition Cwhaapst einr o4rd-erO—bnjeoctt -oOnrliye ntote adc Pcroougnrat mfomr tihnge wchitahn Cg#es brought about with the minor release of the .NET Cphlaapttfoerr m5, b-uEt xtoc eepxtpioannsd a nudp oOnb jaencdt Limifeptrimovee the existing content. As I write this frontmatter, version 1.1 of the C.hNaEptTe rp 6latfo-rImnt eisr fjaucsets a abnodu tC oofllfeiccitaiol,n asnd I am happy to say that C# and the .NET Platform, Second Edition is Cbheapintger r e7lea-sCeadl lbina ctakn Idnetemrf.aces, Delegates, and Events Chapter 8 - Advanced C# Type Construction Techniques As in the first edition, this second edition presents the C# programming language and .NET base class Part Three - Programming with .NET Assemblies libraries using a friendly and approachable tone. I have never under-stood the need some technical Chapter 9 - Understanding .NET Assemblies authors have to spit out prose that reads more like a GRE vocabulary study guide than a readable Chapter 10 - Processes, AppDomains, Contexts, and Threads discourse. As well, this new edition remains focused on providing you with the information you need to Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming build software solutions today, rather than spending too much time focusing on esoteric details that few Pianrdt iFvioduura -l sL ewvilel reavgeinr ga cthtuea .lNlyE cTa Lrieb raabrioeust. To this end, when I do dive under the hood and check out some Cmhaoprtee rl o1w2-l-evOeblj efucnt cSteiorinaalizlitayt ioonf tahned C thLeR . (NoErT b Rloecmkost oinfg C LIaLy ceorde), I promise it will prove enlightening (rather Cthhaapnte sri m13pl-e Beuyield cinagn ad yB)e.tter Window (Introducing Windows Forms) Chapter 14 - A Better Painting Framework (GDI+) CWhapete r' r1e5 -aP rTogeraammmi,n gY woituh Wainnddow Is Forms Controls Chapter 16 - The System.IO Namespace CThaepcthenr o1l7og-y Daauttah oArcsc ewsrsi tew iftohr AaD dOe.NmEaTnding group of people (I should know, I'm one of them). You know Ptahrat tF bivueil d- iWnge bs oAfptwpalicrea tsioonlust iaonnds XuMsiLn gW aenby S pelravtifcoersm is extremely detailed and is very specific to your Cdheapptaerrt m18en-t,A cSoPm.NpEaTn Wy,e cbl iePangt ebsa saend, aWnedb s Cuobnjetrcot lsmatter. Perhaps you work in the electronic publishing Cihnadputsetrr y1,9 d-evAeSlPo.pN sEyTs Wteembs A fpoprl itchaet iostnaste or local government, work at NASA or a branch of the military. CShappetaekr in2g0 f-orX MmLy sWeelfb, IS hearvviece dseveloped children's educational software, various n-tier systems, as well as Innduemxerous projects within the medical and financial world. The chances are almost 100 percent that the Licsot doef Fyioguu rwesrite at your place of employment has little to do with the code I write at mine (unless we happened to work together previously!). List of Tables 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. 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 An Overview of the Second Edition C# and the .NET Platform, Second Edition by Andrew Troelsen ISBN:1590590554 C# and the .NET APplraetsfosr ©m 2, 0S03e c(1o2n00d pEagdeisti)on is logically divided into five distinct sections, each of which contains some number of chapters that somehow "belong together." If you read the first edition of this text, This comprehensive text starts with a brief overview of the you will notice somC#e lsainmgiulaargiteie asn idn tchheanp qteuric nkalym meosv; ehso twoe kveeyr ,t ebceh aniwcaalr ean tdhat just about every page has been updated with newa rccohnitteecnttu. rYalo ius swuiells aflosro . NnEoTtic dee vthealot pseorms.e topics in the first edition (such as .NET delegates) have been moved into an entire chapter of their very own. Of course, as you would hope, the second edition contains several brand new chapters (such as an exploration of .NET Remoting, and a Tambluec ohf d Ceoenpteern etxsamination of ASP.NET). C# and the .NET Platform, Second Edition InOtrno dthuec tfiloipn side, I did choose to remove some topics from the second edition to make room for new content. The most notable omission is the topic of COM and .NET interoperability, which in no way, shape, Part One - Introducing C# and the .NET Platform or form reflects the importance of this topic. In fact, I felt this topic was so important, that I wrote an entire Chapter 1 - The Philosophy of .NET book on the subject. If you require a detailed examination, check out COM and .NET Interoperability Chapter 2 - Building C# Applications (Apress, 2002). Part Two - The C# Programming Language Chapter 3 - C# Language Fundamentals These things being said, here is a chapter-by-chapter breakdown of the text. 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 Part One: Introducing C# and the .NET Platform C# and the .NET Platform, Second Edition by Andrew Troelsen ISBN:1590590554 Chapter 1: ATphreess P© 2h00i3l o(12s00o ppagehs)y of .NET This comprehensive text starts with a brief overview of the C# language and then quickly moves to key technical and This first chapter functions as the backbone for the remainder of this text. We begin by examining the architectural issues for .NET developers. world of traditional Windows development and uncover the short-comings with the previous state of affairs. The primary goal of this chapter, however, is to acquaint you with a number of .NET-centric building blocks such as the common language runtime (CLR), Common Type System (CTS), Common Language Table of Contents Specification (CLS), and the base class libraries. You also take an initial look at the C# programming C# and the .NET Platform, Second Edition language, the role of the .NET assembly, and various development utilities that ship with the .NET SDK. Introduction Part One - Introducing C# and the .NET Platform Chapter 2: Building C# Applications Chapter 1 - The Philosophy of .NET Chapter 2 - Building C# Applications The goal of this chapter is to introduce you to the process of compiling and debugging C# source code Part Two - The C# Programming Language files using various approaches. First, you learn to make use of the command-line compiler (csc.exe) and Chapter 3 - C# Language Fundamentals examine each of the corresponding command-line flags. Over the remainder of the chapter, you learn Chapter 4 - Object-Oriented Programming with C# how to make use of the Visual Studio .NET IDE, navigate the official .NET help system (MSDN), and Chapter 5 - Exceptions and Object Lifetime understand the role of XML-based source code comments. 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 Part Two: The C# Programming Language C# and the .NET Platform, Second Edition by Andrew Troelsen ISBN:1590590554 Chapter 3: ACpr#e sLs ©a 2n00g3 (u12a00g paege sF)undamentals This comprehensive text starts with a brief overview of the C# language and then quickly moves to key technical and This chapter examines the core constructs of the C# programming language. Here you come to architectural issues for .NET developers. understand basic class construction techniques, the distinction between value types and reference types, iteration and decision constructs, boxing and unboxing, and the role of everybody's favorite base class, System.Object. Also, Chapter 3 illustrates how the .NET platform places a spin on various commonplace Table of Contents programming constructs such as enumerations, arrays, and string processing. C# and the .NET Platform, Second Edition Introduction Chapter 4: Object-Oriented Programming with C# Part One - Introducing C# and the .NET Platform Chapter 1 - The Philosophy of .NET The role of Chapter 4 is to examine the details of how C# accounts for each "pillar" of object-oriented Chapter 2 - Building C# Applications programming: encapsulation, inheritance, and polymorphism. In addition to examining the syntax used to Part Two - The C# Programming Language build class hierarchies, you are exposed to various tools within Visual Studio .NET which may be used to Chapter 3 - C# Language Fundamentals decrease your typing time. Chapter 4 - Object-Oriented Programming with C# Chapter 5 - Exceptions and Object Lifetime Chapter 5: Exceptions and Object Lifetime Chapter 6 - Interfaces and Collections Chapter 7 - Callback Interfaces, Delegates, and Events Here you learn how to handle runtime anomalies using the official error handling mechanism of the .NET Chapter 8 - Advanced C# Type Construction Techniques platform: structured exception handling. As you will see, exceptions are class types that contain Part Three - Programming with .NET Assemblies information regarding the error at hand and can be manipulated using the "try", "catch", "throw", and Chapter 9 - Understanding .NET Assemblies "finally" keywords of C#. The latter half of this chapter examines how the CLR manages the memory Chapter 10 - Processes, AppDomains, Contexts, and Threads consumed by allocated objects using an associated garbage collector. This discussion also examines the Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming role of the IDisposable interface, which is a perfect lead-in to the next chapter. Part Four - Leveraging the .NET Libraries Chapter 12 - Object Serialization and the .NET Remoting Layer Chapter 6: Interfaces and Collections Chapter 13 - Building a Better Window (Introducing Windows Forms) Chapter 14 - A Better Painting Framework (GDI+) This material builds upon your understanding of object-based development by checking out the topic of Chapter 15 - Programming with Windows Forms Controls interface-based programming. Here you learn how to define types that support multiple behaviors, how to Chapter 16 - The System.IO Namespace discover these behaviors at runtime, and how to selectively hide select behaviors using explicit interface Cihmapplteemr 1e7nt-atDioant.a TAoc csehsos wwcitahs eA DthOe.N uEsTefulness of interface types, the remainder of this chapter examines Ptahret FSivyse te- mW.eCbo Allpepcltiicoantsio nnasm aneds pXaMcLe .W Aesb y Soeur vwicilel ssee, this region of the base class libraries contains Cnhuapmteerr o1u8s -tyApSePs. NthEaTt Wmeaby Pbaeg euss eadn do uWte obf Cthoen tbroolxs, or serve as a foundation for the development of strongly Cthyappetder c 1o9lle-cAtioSnP.sN.ET Web Applications Chapter 20 - XML Web Services InCdehxapter 7: Callback Interfaces, Delegates, and Events List of Figures LiTsth oisf cThaabpletser begins by examining how interface-based programming techniques can be used to build an event-based system. This will function as a point of contrast to the meat of Chapter 7: the delegate type. Simply put, a .NET delegate is an object that "points" to other methods in your application. Using this pattern, you are able to build systems that allow multiple objects to engage in a two-way conversation. After you examine the use of .NET delegates, you are then introduced to the C# "event" keyword, which is used to simplify the manipulation of raw delegate programming. Chapter 8: Advanced C# Type Construction Techniques The final chapter of this section completes your study of the C# programming language by introducing you to a number of advanced programming techniques. For example, here you learn how to overload operators and create custom conversion routines (both implicit and explicit), as well how to manipulate C- style pointers within a *.cs code file. This chapter also takes the time to explain how these C#-centric programming constructs can be accessed by other .NET programming languages (such as Visual Basic .NET), which is a natural lead-in to the topic of .NET assemblies. Part Three: Programming with .NET Assemblies C# and the .NET Platform, Second Edition by Andrew Troelsen ISBN:1590590554 Chapter 9: AUprnesds e© r20s03t a(1n200d piangegs) .NET Assemblies This comprehensive text starts with a brief overview of the C# language and then quickly moves to key technical and From a very high level, an assembly can be considered the term used to describe a managed *.dll or *.exe architectural issues for .NET developers. file. However, the true story of .NET assemblies is far richer than that. Here you learn the distinction between single-file and multifile assemblies and how to build and deploy each entity. Next, this chapter examines how private and shared assemblies may be configured using XML-based *.config files and Table of Contents publisher policy *.dlls. Along the way, you investigate the internal structure of the Global Assembly Cache C# and the .NET Platform, Second Edition (GAC) and learn how to force Visual Studio .NET to display your custom assemblies within the Add Introduction Reference dialog box (trust me, this is one of the most common questions I am asked). Part One - Introducing C# and the .NET Platform Chapter 1 - The Philosophy of .NET Chapter 10: Processes, AppDomains, Contexts, and Threads Chapter 2 - Building C# Applications Part Two - The C# Programming Language Now that you have a solid understanding of assemblies, this chapter dives much deeper into the Chapter 3 - C# Language Fundamentals composition of a loaded .NET executable. The goal of Chapter 10 is to define several terms and illustrate Chapter 4 - Object-Oriented Programming with C# the relationship between processes, application domains, contextual boundaries, and threads. Once these Chapter 5 - Exceptions and Object Lifetime terms have been qualified, the remainder of this chapter is devoted to the topic of building multithread Chapter 6 - Interfaces and Collections applications using the types of the System.Threading namespace. Be aware that the information Chapter 7 - Callback Interfaces, Delegates, and Events presented here provides a solid foundation for understanding the .NET Remoting layer (examined in Chapter 8 - Advanced C# Type Construction Techniques Chapter 12). Part Three - Programming with .NET Assemblies Chapter 9 - Understanding .NET Assemblies Chapter 11: Type Reflection, Late Binding, and Attribute-Based Chapter 10 - Processes, AppDomains, Contexts, and Threads Programming Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming Part Four - Leveraging the .NET Libraries Chapter 11 concludes our examination of .NET assemblies by checking out the process of runtime type Chapter 12 - Object Serialization and the .NET Remoting Layer discovery via the System.Reflection namespace. Using these types, you are able to build applications that Chapter 13 - Building a Better Window (Introducing Windows Forms) can read an assembly's metadata on the fly (think object browsers). Next, you learn how to dynamically Chapter 14 - A Better Painting Framework (GDI+) activate and manipulate types at runtime using late binding. The final topic of this chapter explores the role Chapter 15 - Programming with Windows Forms Controls of .NET attributes (both standard and custom). To illustrate the usefulness of each of these topics, the Chapter 16 - The System.IO Namespace chapter concludes with the construction of an extendable Windows Forms application. 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

Description:
Framework, but Andrew Troelsen also shows programmers what they need to know . I would like to dedicate this book to my father, Wally Troelsen.
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.