1. Trang chủ
  2. » Công Nghệ Thông Tin

Wrox beginning visual c sharp 2005 nov 2005 ISBN 0764578472

594 59 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 594
Dung lượng 17,61 MB

Nội dung

Next Page Beginning Visual C# 2005 byKarli Watsonet al Wrox Press 2006 (1102 pages) ISBN:0764578472 W ith helpful hints, tips, ex ercises, and ex am ple code, this book covers everything you need to k now about Visual C# 2005 and the NET Fram ework to create secure applications for m obile devices, W eb applications, W indows applications, and W eb services Table of Contents Beginning Visual C # 2005 Introduction Part I - The C# Language C hapter - Introducing C # C hapter - Writing a C # Program C hapter - Variables and Expressions C hapter - Flow C ontrol C hapter - More about Variables C hapter - Functions C hapter - Debugging and Error Handling C hapter - Introduction to Object-Oriented Programming C hapter - Defining C lasses C hapter 10 - Defining C lass Members C hapter 11 - C ollections, C omparisons, and C onversions C hapter 12 - Generics C hapter 13 - Additional OOP Techniques Part II - Windows Programming C hapter 14 - Basic Windows Programming C hapter 15 - Advanced Windows Forms Features C hapter 16 - Using C ommon Dialogs C hapter 17 - Deploying Windows Applications Part III - Web Programming C hapter 18 - Basic Web Programming C hapter 19 - Advanced Web Programming C hapter 20 - Web Services C hapter 21 - Deploying Web Applications Part IV - Data Access C hapter 22 - File System Data C hapter 23 - XML C hapter 24 - Databases and ADO.NET C hapter 25 - Data Binding Part V - Additional Techniques C hapter 26 - NET Assemblies C hapter 27 - Attributes C hapter 28 - XML Documentation C hapter 29 - Networking C hapter 30 - Introduction to GDI+ Index List of Figures List of Try It Outs Next Page Next Page Back Cover C reating next-generation software and applications is now easier than ever with the release of Visual C # 2005 This accessible book guides you through all aspects of C # programming and the capabilities of Visual Studio 2005 so that you can begin developing customized applications You'll first learn all aspects of the C # language, from the fundamentals to object-oriented techniques You'll then quickly progress through Windows and Web programming to making use of data sources, and finally to some advanced techniques such as XML documentation and graphics programming with GDI+ Throughout the book, you'll also find helpful hints, tips, exercises, and full-fledged example code that will enhance your programming skills This book covers everything you need to know about Visual C # 2005 and the NET Framework to create powerful, secure applications for mobile devices, Web applications, Windows applications, and Web services What you will learn from this book Ways to add functionality to your Visual C # applications How to publish applications to the Web with the click of a button Techniques for assembling advanced Windows applications with a minimum of effort and time Tips for using Web services to add complex data and functionality to Web applications How to improve your C # applications using object-oriented programming Steps for using ADO.NET to interact with databases and deal with XML Who this book is for This book is for anyone who wants to learn how to program in C # using the NET Framework It is also for programmers who know NET 1.0 and want to find out about the latest features of NET 2.0 and Visual Studio 2005 Next Page Next Page Beginning Visual C# 2005 Karli Watson Christian Nagel Jacob Hammer Pedersen Jon D Reid Morgan Skinner Eric White Published by Wiley Publishing, Inc 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright 2006 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN-13: 978-0-7645-7847-2 ISBN-10: 0-7645-7847-2 Manufactured in the United States of America 10 1O/RR/RQ/QV/IN Library of Congress Cataloging-in-Publication Data: Beginning Visual C# 2005 / Karli Watson [et al.] p cm Updated ed of: Beginning Visual C# 2003 Includes index ISBN-13: 978-0-7645-7847-2 (paper/website) ISBN-10: 0-7645-7847-2 (paper/website) C# (Computer program language) Microsoft NET Framework I Watson, Karli II Beginning Visual C# QA76.73.C154B483 2005 005.13'3 dc22 2005010692 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600 Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ For general information on our other products and services please contact our Customer Care Department within the United States at (800) 762-2974, outside the United States at (317) 5723993 or fax (317) 572-4002 Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc and/or its affiliates, in the United States and other countries, and may not be used without written permission Visual C# is a registered trademark of Microsoft Corporation in the United States and/or other countries All other trademarks are the property of their respective owners Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book Wiley also publishes its books in a variety of electronic formats Some content that appears in print may not be available in electronic books Credits Acquisitions Editor Katie Mohr Development Editor Tom Dinse Technical Editor Todd Meister Production Editor Angela Smith Copy Editor Foxxe Editorial Services Editorial Manager Mary Beth Wakefield Vice President & Executive Group Publisher Richard Swadley Vice President and Publisher Joseph B Wikert Project Coordinators Ryan Steffen Erin Smith Graphics and Production Specialists Andrea Dahl Denny Hager Jennifer Heleine Stephanie Jumper Barbara Moore Shelley Norris Lynsey Osborn Heather Ryan Alicia South Ron Terry Julie Trippetti Quality Control Technicians Laura Albert Leeann Harney Carl William Pierce Proofreading and Indexing TECHBOOKS Production Services for donna —Karli Watson I'd like to dedicate my portion of this book to my wife, Beth, and our children Nathaniel, Timothy, and Walter Thanks for your support and encouragement Also a big thank you to my coauthors and the teamat Wrox/Wiley —Jon Reid About the Authors Karli Watson is the technical director of 3form (www.3form.net), as well as a freelance IT specialist, author, developer, and consultant For the most part, he immerses himself in NET (in particular C#) and has written numerous books in the field for several publishers He specializes in communicating complex ideas in a way that is accessible to anyone with a passion to learn, and spends much of his time playing with new technology to find new things to teach people about During those (seemingly few) times where he isn't doing the above, Karli will probably be wishing he was hurtling down a mountain on a snowboard Or possibly trying to get his novel published Either way, you'll know him by his brightly colored clothes Christian Nagel is a software architect, trainer, and consultant, and an associate of Thinktecture, offering training and coaching based on Microsoft NET technologies His achievements in the developer community have earned him a position as Microsoft Regional Director and MVP for Visual C# He enjoys an excellent reputation as an author of several NET books, such as Professional C#, Pro NET Network Programming and C# Web Services, and he speaks regularly at international industry conferences Christian looks back on more than 15 years of experience as a developer and software architect He started his computing career on PDP 11 and VAX/VMS, covering a variety of languages and platforms Since 2000 he has been working with NET and C#, developing and architecting distributed solutions http://www.christiannagel.com http://www.thinktecture.com Jacob Hammer Pedersen is a systems developer at Fujitsu Service, Denmark He's been programming the PC since the early 90s using languages such as Pascal, Visual Basic, C/C++, and in later years C# Jacob is an MCSD who works almost exclusively on the Microsoft platform where his expertise includes NET, COM, COM+/Enterprise Services, SQL Server, and MS Office development A Danish citizen, he works and lives in Aarhus, Denmark Jon D Reid is the President and Chief Technology Officer for Savitar Corporation, an independent software vendor and consulting company that develops database tools for the Microsoft.NET environment He has co-authored many NET books, including Pro Visual Studio NET, Fast Track to C# Programming, ADO.NET Programmer's Reference, and Professional SQL Server 2000 XML Jon would like to thank his family, co-authors, and the team at Wrox for their support and encouragement Morgan Skinner began his computing career at a tender age on a Sinclair ZX80 at school, where he was underwhelmed by some code a teacher had written and so began programming in assembly language After getting hooked on Z80 (which he believes is far better than those paltry registers on the 6502), he graduated through the school's ZX81s to his own ZX Spectrum Since then he's used all sorts of languages and platforms, including VAX Macro Assembler, Pascal, Modula2, Smalltalk, X86 assembly language, PowerBuilder, C/C++, VB, and currently C# He's been programming in NET since the PDC release in 2000, and liked it so much, he joined Microsoft in 2001 He now works in Premier Support for Developers and spends most of his time assisting customers with C# You can reach Morgan at http://www.morganskinner.com Eric White is an independent software consultant with over 20 years experience in building management information systems and accounting systems When he isn't hunched over a screen programming in C#, he will most likely be found with an ice axe in hand, climbing some mountain Next Page Next Page Introduction C# is a relatively new language that was unveiled to the world when Microsoft released the first version of its NET Framework Since then its popularity has rocketed, and it has arguably become the language of choice for both Windows and Web developers who use NET Part of the appeal of C# comes from its clear syntax, which derives from C/C++, but simplifies some things that have previously discouraged some programmers Despite this simplification, C# has retained the power of C++, and there is now no reason not to move into C# The language is not difficult, and is an excellent one to learn elementary programming techniques with This ease of learning, combined with the capabilities of the NET Framework, make C# an excellent way to start your programming career The latest release of C#, part of NET 2.0, builds on the existing successes and adds even more attractive features Some of these, again, have their roots in C++—at least superficially—but some are entirely new The latest release of Visual Studio also brings many tweaks and improvements to make your life easier and dramatically increase your productivity This book is intended to teach you about all aspects of C# programming, from the language itself, through Windows and Web programming, to making use of data sources, and finally to some advanced techniques such as graphics programming You'll also learn about the capabilities of Visual Studio 2005 and all the ways that it can aid your application development The book is written in a friendly, mentor-style fashion, where each chapter builds on previous ones and every effort is made to ease you into advanced techniques painlessly At no point will technical terms appear from nowhere to discourage you from continuing; every concept is introduced and discussed as required Technical jargon is kept to a minimum, but where it is necessary, it too will be properly defined and laid out in context The authors of this book are all experts in their field, and are all enthusiastic in their passion for both the C# language and the NET Framework Nowhere will you find a group of people better qualified to take you under their collective wing and nurture your understanding of C# from first principles to advanced techniques Along with the fundamental knowledge it provides, this book is packed full of helpful hints, tips, exercises, and fully-fledged example code (available for download at p2p.wrox.com) that you will find yourself using time and again as your career progresses We pass this knowledge on without begrudging it, and hope that you will be able to use it to become the best programmer you can be Good luck, and all the best! Who This Book Is For This book is for everyone who wants to learn how to program in C# using the NET Framework The early chapters cover the language itself, assuming no prior programming experience If you have programmed in other languages before, then much of the material in these chapters will be familiar Many aspects of C# syntax are shared with other languages, and many structures are common to practically all programming languages (such as looping and branching structures) However, even if you are an experienced programmer you will benefit from looking through these chapters to learn the specifics of how these techniques apply to C# If you are new to programming, you should start from the beginning If you are new to NET but know how to program, you should read Chapter and then skim through the next few chapters before getting on to the application of the C# language If you know how to program but haven't encountered an object oriented programming language before, you should read the chapters from Chapter onward Alternatively, if you already know the C# language you may wish to concentrate on the chapters dealing with NET 2.0 changes, specifically the chapters on Collections and Generics (Chapters 11 and 12), or skip the first section of the book completely and start with Chapter 14 The chapters in this book are written with a dual purpose in mind: They can be read sequentially to provide a complete tutorial in the C# language, and they can be dipped into as required as a reference material In addition to the core material, each chapter also includes a selection of exercises that you can work through to ensure that you have understood the material taught The exercises range from simple multiple choice or true/false questions to more involved questions that require you to modify or build applications The answers to all the exercises are provided online at p2p.wrox.com Next Page Next Page How This Book Is Structured This book is divided into six sections, as follows: Introduction: which you're reading at the moment The C# Language: which covers all aspects of the C# language, from the fundamentals to object- oriented techniques Windows Programming: this section looks at how to write Windows applications in C#, and how to deploy them Web Programming: this section describes Web application development, Web services, and Web application deployment Data Access: which looks at using data in your applications, including data stored in files on your hard disk, data stored in XML format, and data in databases Additional Techniques: this section examines some extra ways of using C# and the NET Framework, including assemblies, attributes, XML documentation, networking, and graphics programming with GDI+ The following sections describe the chapters in the five major sections of this book The C# Language (Chapters 1–13) Chapter introduces you to C# and how it fits into the NET landscape You'll learn the fundamentals of programming in this environment, and how VS fits in Chapter starts you off with writing C# applications in VS You'll look at the syntax of C# and put the language to use with sample command line and Windows applications These examples will show you just how quick and easy it can be to get up and running, and along the way you'll be introduced to the VS development environment and the basic windows and tools that you'll be using throughout the book Next you'll learn more about the basics of the C# language You'll learn what variables are and how to manipulate them in Chapter You'll enhance the structure of your applications with flow control (looping and branching) in Chapter 4, and see some more advanced variable types such as arrays in Chapter In Chapter you'll start to encapsulate your code in the form of functions, which make it much easier to perform repetitive operations and make your code much more readable By the start of Chapter you'll have a handle on the fundamentals of the C# language, and will focus on debugging your applications This involves looking at outputting trace information as your applications are executed, and at how VS can be used to trap errors and lead you to solutions for them with its powerful debugging environment From Chapter onward you'll learn about Object-Oriented Programming (OOP), starting with a look at what this term means, and an answer to the eternal question "What is an object?" OOP can seem quite difficult at first The whole of Chapter is devoted to demystifying it and explaining what makes it so great, and you won't actually be dealing with much C# code until the very end of the chapter All this changes in Chapter 9, when you put theory into practice and start using OOP in your C# applications This is where the true power of C# lies You'll start by looking at how to define classes and interfaces, then move on to class members (including fields, properties, and methods) in Chapter 10 At the end of that chapter you'll start to assemble a card game application, which will be developed over several chapters, and will help to illustrate OOP Once you've leaned how OOP works in C#, you'll move on in Chapter 11 to look at common OOP scenarios, including dealing with collections of objects, and comparing and converting objects Chapter 12 then moves on to look at a new and very useful feature of C# in NET 2.0: generics, which allows you to create very flexible classes Finally Chapter 13 rounds off the discussion of the C# language and OOP with some additional techniques, and notable events, which become very important in, for example, Windows programming Windows Programming (Chapters 14–17) Chapter 14 starts by introducing you to what is meant by Windows programming, and looks at how this is achieved in VS Again, you'll start with the basics and build up your knowledge over this chapter and in Chapter 15, seeing how you can use the wealth of controls supplied by the NET Framework in your applications You'll quickly understand how NET enables you to build Windows applications in a graphical way, and assemble advanced applications with the minimum of effort and time Chapter 16 looks at some commonly used features that can add specialized features with ease, such as file management, printing, and so on Chapter 17 then discusses deploying your applications, including making installation programs to enable your users to get up and running with your applications in double-quick time Web Programming (Chapters 18–21) This section is structured in a similar way to the Windows programming section It starts with Chapter 18 describing the controls that make up the simplest of Web applications, and how you can fit them together and make them perform tasks using ASP.NET Chapter 19 builds on this and introduces more advanced techniques, versatile controls, and state management in the context of the Web, as well as conforming to Web standards Chapter 20 is an excursion into the wonderful world of Web services, which are set to revolutionize the way people use the Internet Web services enable you to expose complex data and functionality to Web and windows applications in a platform-independent way This chapter discusses how to use and create Web services, and the additional tools that NET provides, including security Finally, Chapter 21 examines the deployment of Web applications and services, in particular the new features of VS that enable you to publish applications to the Web with the click of a button Data Access (Chapters 22–25) Chapter 22 looks at how your applications can save and retrieve data to disk, both as simple text files and as more complex representations of data You'll also see how to compress data, how to work with legacy data such as comma separated value (CSV) files, and how to monitor and act on file system changes In Chapter 23 you'll learn about what is fast becoming the de-facto standard for data exchange, namely XML You'll have touched on XML at several times in preceding chapters, but in this chapter you'll lay out the ground rules and see what all the excitement is about This will be put into practice straight away in Chapter 24, where you'll see how to use ADO.NET to interact with databases ADO.NET includes techniques to deal with XML, and much more Chapter 25 will then show you some excellent ways to make use of ADO.NET in your applications via data binding, which is a great way to simplify database access—especially since it requires little effort on your part to provide a user interface to data Additional Techniques (Chapters 26–30) In the last section of the book you'll look at a wide variety of additional C# and NET subjects In Chapter 26 you'll learn more about NET assemblies, the basic building blocks of all sorts of NET applications In Chapter 27 you'll look at attributes, a powerful way to both include additional information about types in assemblies, and add functionality that would otherwise be difficult to implement Chapter 28 deals with XML documentation and how you can document your applications at the source code level You'll see how to add this information and how to use and extract it You'll take this to the point where you'll be able to generate expansive MSDN-style documentation from your code Next you'll look at networking in Chapter 29, and how your applications can communicate with each other and with other services across various types of networks Finally, Chapter 30 comes almost as a bit of light relief from many of the involved techniques you'll have seen earlier in the book by covering the subject of graphics programming with GDI+ You'll learn how to manipulate graphics and style your applications, opening the door to a vast array of C# applications and having a bit of fun along the way Next Page Next Page What You Need to Use This Book The code and descriptions of C# and the NET Framework in this book apply to NET 2.0 You don't need anything other than the Framework to understand this aspect of the book, but many of the examples require Visual Studio 2005 (VS) There is also quite a lot of explanation of the VS development environment which may not apply to other tools, such as Visual C# 2005 Express Next Page Next Page Conventions To help you get the most from the text and keep track of what's happening, we've used a number of conventions throughout the book Try It Out The Try It Out is an exercise you should work through, following the text in the book They usually consist of a set of steps Each step has a number Follow the steps through with your copy of the database How It Works After each Try It Out, the code you've typed will be explained in detail Important Boxes like this one hold important, not-to-be forgotten information that is directly relevant to the surrounding text NoteTips, hints, tricks, and asides to the current discussion are offset and placed in italics like this As for styles in the text: We highlight new terms and important words when we introduce them We show keyboard strokes like this: Ctrl+A We show file names, URLs, and code within the text like so: persistence.properties We present code in two different ways: In code examples we highlight new and important code with a gray background The gray highlighting is not used for code that's less important in the present context, or has been shown before Next Page Next Page Source Code As you work through the examples in this book, you may choose either to type in all the code manually or to use the source code files that accompany the book All of the source code used in this book is available for download at http://www.wrox.com Once at the site, simply locate the book's title (either by using the Search box or by using one of the title lists) and click the Download Code link on the book's detail page to obtain all the source code for the book NoteBecause many books have similar titles, you may find it easiest to search by ISBN; for this book the ISBN is 0-7645-7847-2 Once you download the code, just decompress it with your favorite compression tool Alternately, you can go to the main Wrox code download page at http://www.wrox.com/dynamic/books/download.aspx to see the code available for this book and all other Wrox books Next Page Next Page Errata We make every effort to ensure that there are no errors in the text or in the code However, no one is perfect, and mistakes occur If you find an error in one of our books, like a spelling mistake or faulty piece of code, we would be very grateful for your feedback By sending in errata you may save another reader hours of frustration and at the same time you will be helping us provide even higher quality information To find the errata page for this book, go to http://www.wrox.com and locate the title using the Search box or one of the title lists Then, on the book details page, click the Book Errata link On this page you can view all errata that has been submitted for this book and posted by Wrox editors A complete book list including links to each's book's errata is also available at www.wrox.com/misc-pages/booklist.shtml If you don't spot "your" error on the Book Errata page, go to www.wrox.com/contact/techsupport.shtml and complete the form there to send us the error you have found We'll check the information and, if appropriate, post a message to the book's errata page and fix the problem in subsequent editions of the book Next Page Next Page Index Z ZoneTemplate control, 641 Next Page Next Page List of Figures Chapter 1: Introducing C# Figure 1-1 Figure 1-2 Figure 1-3 Figure 1-4 Chapter 2: Writing a C# Program Figure 2-1 Figure 2-2 Figure 2-3 Figure 2-4 Figure 2-5 Figure 2-6 Figure 2-7 Figure 2-8 Figure 2-9 Figure 2-10 Figure 2-11 Figure 2-12 Figure 2-13 Figure 2-14 Figure 2-15 Figure 2-16 Figure 2-17 Chapter 3: Variables and Expressions Figure 3-1 Figure 3-2 Figure 3-3 Figure 3-4 Chapter 4: Flow Control Figure 4-1 Figure 4-2 Figure 4-3 Figure 4-4 Figure 4-5 Figure 4-6 Figure 4-7 Figure 4-8 Chapter 5: More about Variables Figure 5-1 Figure 5-2 Figure 5-3 Figure 5-4 Figure 5-5 Figure 5-6 Figure 5-7 Figure 5-8 Figure 5-9 Figure 5-10 Figure 5-11 Figure 5-12 Figure 5-13 Figure 5-14 Chapter 6: Functions Figure 6-1 Figure 6-2 Figure 6-3 Figure 6-4 Figure 6-5 Figure 6-6 Figure 6-7 Figure 6-8 Figure 6-9 Figure 6-10 Chapter 7: Debugging and Error Handling Figure 7-1 Figure 7-2 Figure 7-3 Figure 7-4 Figure 7-5 Figure 7-6 Figure 7-7 Figure 7-8 Figure 7-9 Figure 7-10 Figure 7-11 Figure 7-12 Figure 7-13 Figure 7-14 Figure 7-15 Figure 7-16 Figure 7-17 Figure 7-18 Figure 7-19 Figure 7-20 Figure 7-21 Figure 7-22 Figure 7-23 Figure 7-24 Chapter 8: Introduction to Object-Oriented Programming Figure 8-1 Figure 8-2 Figure 8-3 Figure 8-4 Figure 8-5 Figure 8-6 Figure 8-7 Figure 8-8 Figure 8-9 Figure 8-10 Figure 8-11 Figure 8-12 Figure 8-13 Figure 8-14 Figure 8-15 Chapter 9: Defining Classes Figure 9-1 Figure 9-2 Figure 9-3 Figure 9-4 Figure 9-5 Figure 9-6 Figure 9-7 Figure 9-8 Figure 9-9 Figure 9-10 Figure 9-11 Figure 9-12 Figure 9-13 Figure 9-14 Figure 9-15 Figure 9-16 Figure 9-17 Chapter 10: Defining Class Members Figure 10-1 Figure 10-2 Figure 10-3 Figure 10-4 Figure 10-5 Figure 10-6 Figure 10-7 Figure 10-8 Figure 10-9 Figure 10-10 Figure 10-11 Figure 10-12 Figure 10-13 Figure 10-14 Figure 10-15 Figure 10-16 Figure 10-17 Figure 10-18 Chapter 11: Collections, Comparisons, and Conversions Figure 11-1 Figure 11-2 Figure 11-3 Figure 11-4 Figure 11-5 Figure 11-6 Figure 11-7 Figure 11-8 Chapter 12: Generics Figure 12-1 Figure 12-2 Figure 12-3 Figure 12-4 Figure 12-5 Chapter 13: Additional OOP Techniques Figure 13-1 Figure 13-2 Figure 13-3 Figure 13-4 Figure 13-5 Figure 13-6 Figure 13-7 Chapter 14: Basic Windows Programming Figure 14-1 Figure 14-2 Figure 14-3 Figure 14-4 Figure 14-5 Figure 14-6 Figure 14-7 Figure 14-8 Figure 14-9 Figure 14-10 Figure 14-11 Figure 14-12 Figure 14-13 Figure 14-14 Figure 14-15 Figure 14-16 Figure 14-17 Figure 14-18 Figure 14-19 Figure 14-20 Figure 14-21 Figure 14-22 Figure 14-23 Figure 14-24 Figure 14-25 Figure 14-26 Chapter 15: Advanced Windows Forms Features Figure 15-1 Figure 15-2 Figure 15-3 Figure 15-4 Figure 15-5 Figure 15-6 Figure 15-7 Figure 15-8 Figure 15-9 Figure 15-10 Figure 15-11 Figure 15-12 Figure 15-13 Figure 15-14 Figure 15-15 Figure 15-16 Figure 15-17 Figure 15-18 Figure 15-19 Chapter 16: Using Common Dialogs Figure 16-1 Figure 16-2 Figure 16-3 Figure 16-4 Figure 16-5 Figure 16-6 Figure 16-7 Figure 16-8 Figure 16-9 Figure 16-10 Figure 16-11 Figure 16-12 Figure 16-13 Figure 16-14 Figure 16-15 Figure 16-16 Figure 16-17 Figure 16-18 Figure 16-19 Figure 16-20 Figure 16-21 Figure 16-22 Figure 16-23 Figure 16-24 Figure 16-25 Figure 16-26 Figure 16-27 Figure 16-28 Figure 16-29 Figure 16-30 Figure 16-31 Chapter 17: Deploying Windows Applications Figure 17-1 Figure 17-2 Figure 17-3 Figure 17-4 Figure 17-5 Figure 17-6 Figure 17-7 Figure 17-8 Figure 17-9 Figure 17-10 Figure 17-11 Figure 17-12 Figure 17-13 Figure 17-14 Figure 17-15 Figure 17-16 Figure 17-17 Figure 17-18 Figure 17-19 Figure 17-20 Figure 17-21 Figure 17-22 Figure 17-23 Figure 17-24 Figure 17-25 Figure 17-26 Figure 17-27 Figure 17-28 Figure 17-29 Figure 17-30 Figure 17-31 Figure 17-32 Figure 17-33 Figure 17-34 Figure 17-35 Figure 17-36 Figure 17-37 Figure 17-38 Figure 17-39 Chapter 18: Basic Web Programming Figure 18-1 Figure 18-2 Figure 18-3 Figure 18-4 Figure 18-5 Figure 18-6 Figure 18-7 Figure 18-8 Figure 18-9 Figure 18-10 Figure 18-11 Figure 18-12 Figure 18-13 Figure 18-14 Figure 18-15 Figure 18-16 Figure 18-17 Figure 18-18 Figure 18-19 Figure 18-20 Figure 18-21 Figure 18-22 Figure 18-23 Figure 18-24 Figure 18-25 Figure 18-26 Figure 18-27 Figure 18-28 Figure 18-29 Figure 18-30 Figure 18-31 Figure 18-32 Figure 18-33 Figure 18-34 Chapter 19: Advanced Web Programming Figure 19-1 Figure 19-2 Figure 19-3 Figure 19-4 Figure 19-5 Figure 19-6 Figure 19-7 Figure 19-8 Figure 19-9 Figure 19-10 Figure 19-11 Figure 19-12 Figure 19-13 Figure 19-14 Figure 19-15 Figure 19-16 Figure 19-17 Figure 19-18 Chapter 20: Web Services Figure 20-1 Figure 20-2 Figure 20-3 Figure 20-4 Figure 20-5 Figure 20-6 Figure 20-7 Figure 20-8 Figure 20-9 Figure 20-10 Figure 20-11 Figure 20-12 Figure 20-13 Figure 20-14 Figure 20-15 Figure 20-16 Figure 20-17 Figure 20-18 Figure 20-19 Figure 20-20 Chapter 21: Deploying Web Applications Figure 21-1 Figure 21-2 Figure 21-3 Figure 21-4 Figure 21-5 Figure 21-6 Figure 21-7 Figure 21-8 Figure 21-9 Figure 21-10 Figure 21-11 Figure 21-12 Figure 21-13 Figure 21-14 Figure 21-15 Figure 21-16 Figure 21-17 Chapter 22: File System Data Figure 22-1 Figure 22-2 Figure 22-3 Figure 22-4 Figure 22-5 Figure 22-6 Figure 22-7 Figure 22-8 Figure 22-9 Figure 22-10 Figure 22-11 Figure 22-12 Figure 22-13 Chapter 23: XML Figure 23-1 Figure 23-2 Figure 23-3 Figure 23-4 Figure 23-5 Figure 23-6 Figure 23-7 Figure 23-8 Chapter 24: Databases and ADO.NET Figure 24-1 Figure 24-2 Figure 24-3 Figure 24-4 Figure 24-5 Figure 24-6 Figure 24-7 Figure 24-8 Figure 24-9 Figure 24-10 Figure 24-11 Figure 24-12 Figure 24-13 Figure 24-14 Figure 24-15 Figure 24-16 Figure 24-17 Figure 24-18 Chapter 25: Data Binding Figure 25-1 Figure 25-2 Figure 25-3 Figure 25-4 Figure 25-5 Figure 25-6 Figure 25-7 Figure 25-8 Figure 25-9 Figure 25-10 Figure 25-11 Figure 25-12 Figure 25-13 Figure 25-14 Figure 25-15 Figure 25-16 Figure 25-17 Figure 25-18 Figure 25-19 Figure 25-20 Figure 25-21 Figure 25-22 Figure 25-23 Figure 25-24 Figure 25-25 Figure 25-26 Figure 25-27 Figure 25-28 Figure 25-29 Figure 25-30 Figure 25-31 Figure 25-32 Chapter 26: NET Assemblies Figure 26-1 Figure 26-2 Figure 26-3 Figure 26-4 Figure 26-5 Figure 26-6 Figure 26-7 Figure 26-8 Figure 26-9 Figure 26-10 Figure 26-11 Figure 26-12 Figure 26-13 Figure 26-14 Figure 26-15 Figure 26-16 Figure 26-17 Figure 26-18 Figure 26-19 Figure 26-20 Figure 26-21 Figure 26-22 Chapter 27: Attributes Figure 27-1 Figure 27-2 Figure 27-3 Figure 27-4 Figure 27-5 Figure 27-6 Figure 27-7 Figure 27-8 Figure 27-9 Figure 27-10 Chapter 28: XML Documentation Figure 28-1 Figure 28-2 Figure 28-3 Figure 28-4 Figure 28-5 Figure 28-6 Figure 28-7 Figure 28-8 Figure 28-9 Figure 28-10 Figure 28-11 Chapter 29: Networking Figure 29-1 Figure 29-2 Figure 29-3 Figure 29-4 Figure 29-5 Figure 29-6 Figure 29-7 Figure 29-8 Figure 29-9 Figure 29-10 Figure 29-11 Figure 29-12 Figure 29-13 Figure 29-14 Chapter 30: Introduction to GDI+ Figure 30-1 Figure 30-2 Figure 30-3 Figure 30-4 Figure 30-5 Figure 30-6 Figure 30-7 Figure 30-8 Figure 30-9 Figure 30-10 Figure 30-11 Figure 30-12 Figure 30-13 Figure 30-14 Figure 30-15 Figure 30-16 Figure 30-17 Figure 30-18 Next Page List of Try It Outs Introduction Try It Out Chapter 2: Writing a C# Program Try It Out – Creating a Simple Console Application Try It Out – Creating a Simple Windows Application Chapter 3: Variables and Expressions Try It Out – Using Simple Type Variables Try It Out – Manipulating Variables with Mathematical Operators Chapter 4: Flow Control Try It Out – Using the Boolean and Bitwise Operators Try It Out – Using the if Statement Try It Out – Using the switch Statement Try It Out – Using Loops Try It Out – Using while Loops Try It Out – Using for Loops Chapter 5: More about Variables Try It Out – Type Conversions in Practice Try It Out – Using an Enumeration Try It Out – Using a Struct Try It Out – Using an Array Try It Out – Statement Auto-completion in VS Chapter 6: Functions Try It Out – Defining and Using a Basic Function Try It Out – Exchanging Data with a Function Try It Out – Exchanging Data with a Function Part Try It Out – Defining and Using a Basic Function Try It Out – Command-Line Arguments Try It Out – Using a Delegate to Call a Function Chapter 7: Debugging and Error Handling Try It Out – Writing Text to the Output Window Try It Out – Exception Handling Chapter 8: Introduction to Object-Oriented Programming Try It Out – Objects in Action Chapter 9: Defining Classes Try It Out – Defining Classes Try It Out – Generating a Class Diagram Try It Out – Using a Class Library Try It Out – Classes versus Structs Chapter 10: Defining Class Members Try It Out – Using Fields, Methods, and Properties Chapter 11: Collections, Comparisons, and Conversions Try It Out – Arrays versus More Advanced Collections Try It Out – Implementing an Animals Collection Try It Out – Implementing an Iterator Try It Out – Using the is Operator Try It Out – Sorting a List Chapter 12: Generics Try It Out – Nullable Types Try It Out – Using Collection Try It Out – Sorting and Searching List Try It Out – Sorting and Searching List Try It Out – Defining a Generic Class Chapter 13: Additional OOP Techniques Try It Out – Handling Events Try It Out – Defining Events Try It Out – Using a Multipurpose Event Handler Chapter 14: Basic Windows Programming Try It Out – Using Snap-Lines Try It Out – ButtonTest Try It Out – TextBoxTest Try It Out – RadioButton and CheckBox Example Try It Out – RichTextBox Example Try It Out – ListBox Example Try It Out – ListView Example Try It Out – Working with Tab Pages Chapter 15: Advanced Windows Forms Features Try It Out – Professional Menus in Five Seconds Try It Out – Creating Menus from Scratch Try It Out – Handling Menu Events Try It Out – Toolbar Example Try It Out – StatusStrip Try It Out – Creating an MDI Application Try It Out – Creating an MDI Text Editor Try It Out – Merging Menus Try It Out – Tracking Windows Try It Out – LabelTextbox Example Try It Out – Debugging User Controls Chapter 16: Using Common Dialogs Try It Out – Creating the Simple Text Editor Windows Application Try It Out – Adding and Using an OpenFileDialog Try It Out – Adding and Using a SaveFileDialog Try It Out – Setting the Title of the Form Try It Out – Adding a PrintDocument Component Try It Out – Modifying OnPrintPage() for Multiple Pages Try It Out – Adding a PageSetupDialog Try It Out – Adding a PrintDialog Try It Out – Adding a Print Selection Try It Out – Adding a PrintPreviewDialog Chapter 17: Deploying Windows Applications Try It Out – Sign the ClickOnce Manifests Try It Out – Define the Permission Requirements Try It Out – Using the Publish Wizard Try It Out – Installation of the Application Try It Out – Updating the Application Try It Out – Creating a Windows Installer Project Try It Out – Configuring the Project Try It Out – Add Files to the Installer Package Try It Out – Set the File Extension Try It Out – Start the User Interface Editor Try It Out – Configuring the Default Dialogs Try It Out – Adding Other Dialogs Try It Out – Build the Project Chapter 18: Basic Web Programming Try It Out – Create a Simple Web Page Try It Out – Display the User Input Try It Out – Display the Results in a Second Page Try It Out – Create a Strongly Typed PreviousPage Try It Out – Check for Required Input and Email Address Try It Out – Security Configuration Try It Out – Create a Login Page Try It Out – Using the CreateUser Wizard Try It Out – Create a New Database Try It Out – Using a GridView Control to Display Data Try It Out – Configure the GridView Control Chapter 19: Advanced Web Programming Try It Out – Create a Personal Website Try It Out – Create a Master Page Try It Out – Use a Master Page Try It Out – Add Navigation Try It Out – Create a User Control Try It Out – Using a User Control Try It Out – Create Profile Information Try It Out – Create a Web Application Using Web Parts Try It Out – Add an Editor Zone Try It Out – Add a Catalog Zone Try It Out – Create a Connection between Web Parts Chapter 20: Web Services Try It Out – Creating a Web Service Project Try It Out – Adding a Method Try It Out – Creating a Client Windows Application Try It Out – Creating an ASP.NET Client Application Try It Out – Creating Passing Data with a Web Service Chapter 21: Deploying Web Applications Try It Out – Create a New Website Try It Out – Copy a Web Site Try It Out – Precompiling a Website for Deployment Try It Out – Create a Setup Program Try It Out – Installing a Web Application Chapter 22: File System Data Try It Out – Reading Data from Random Access Files Try It Out – Writing Data to Random Access Files Try It Out – Output Stream Try It Out – Stream Input Try It Out – Comma-Separated Values Try It Out – Compressed Data Try It Out – Object Serialization Try It Out – Monitoring the File System Chapter 23: XML Try It Out – Creating an XML Document in Visual Studio Try It Out – Looping through All Nodes in an XML Document Try It Out – Creating Nodes Try It Out – Removing Nodes Try It Out – Selecting Nodes Chapter 24: Databases and ADO.NET Try It Out – Reading Data with the DataReader Try It Out – Reading from an Access Database Try It Out – Reading Data with the DataSet Try It Out – Updating the Database Try It Out – Adding Rows Try It Out – Finding Rows Try It Out – Deleting Rows Try It Out – Getting the Related Rows Try It Out – Working with Multiple Relations Try It Out – Writing XML from a DataSet Try It Out – Reading XML into a DataSet Try It Out – Show SQL Example Try It Out – Retrieving Single Values with ExecuteScalar() Try It Out – Data Modification with ExecuteNonQuery Try It Out – Calling a Stored Procedure Chapter 25: Data Binding Try It Out – Connecting to a Database Try It Out – Compile and Run the Database Application Chapter 26: NET Assemblies Try It Out – Creating the Shapes Component Try It Out – Viewing the Contents of an Assembly with Ildasm Try It Out – Creating a Shapes Client Try It Out – Signing the Shapes Assembly Chapter 27: Attributes Try It Out – Extracting the Public Key Chapter 28: XML Documentation Try It Out – Adding and Viewing Basic XML Documentation Try It Out – Adding XML Documentation in a Class Diagram Try It Out – Processing XML Documentation Chapter 29: Networking Try It Out – Using DNS Try It Out – Simulate a HTTP Request Try It Out – Using the WebClient Class Try It Out – Get a File from an FTP server Try It Out – Create a TCP server Try It Out – Create a TCP Client Chapter 30: Introduction to GDI+ Try It Out – Creating a Graphics Path Try It Out – Creating a Region Try It Out – Creating a Region Try It Out – Pen Example Try It Out – Brush Example Try It Out – Font Example Try It Out – Image Example Try It Out – Drawing an Ellipse with an Image Try It Out – Creating a Pen from an Image Try It Out – Drawing Text with an Image Try It Out – Double-Buffering Example ... it can to correct casing problems Basic C# Console Application Structure Let's take a closer look at the console application example from Chapter (ConsoleApplication1), and break down the structure... (GAC) Placing code in this cache is simple — you just place the assembly containing the code in the directory containing this cache Managed Code The role of the CLR doesn't end once you have compiled... America 10 1O/RR/RQ/QV/IN Library of Congress Cataloging-in-Publication Data: Beginning Visual C# 2005 / Karli Watson [et al.] p cm Updated ed of: Beginning Visual C# 2003 Includes index ISBN- 13:

Ngày đăng: 26/03/2019, 16:03