Computing with c sharp and the net framework 2003

1.3K 169 0
Computing with c sharp and the net framework 2003

Đ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

Computing with C# and the NET Framework ISBN:0763723398 by Art Gittleman Jones and Bartlett Publishers © 2003 (753 pages) Both novice and experienced programmers will find that this text serves as an accessible and thorough guide to object-oriented and event-driven programming concepts through the author's spiral teaching approach CD Content Table of Contents Computing with C# and the NET Framework Preface An Introduction to Chapter 1 Computing with C# Chapter 2 - C# Programming Basics Software Engineering Chapter 3 with Control Structures More Control Structures Chapter 4 and Types Getting Started with Chapter 5 - Object-Oriented Programming Chapter 6 - Working with Objects Chapter 7 - Arrays Event-Driven Chapter 8 Programming Chapter 9 - User Interfaces Chapter 10 - Inheritance Exception Handling and Chapter 11 Input/Output Chapter 12 - Data Structures Chapter 13 - Threads and Animation Chapter 14 - Networking Chapter 15 - Using a Database Chapter 16 - ASP.NET Chapter 17 - XML and Web Services Binary and Hexadecimal Appendix A Numbers Bitwise and Shift Appendix B Operators Operator Precedence Appendix C Table Appendix D - The ASCII Character Set Appendix E - Simple Types Answers to Selected Exercises Index List of Figures List of Code Examples CD Content Back Cover Computing with C# demystifies the art of programming with C# through clear explanations and intuitive examples Both novice and experienced programmers will find that this text serves as an accessible and thorough guide to object-oriented and event-driven programming concepts Readers develop a mastery of objects through the author’s spiral teaching approach: first straightforward examples are presented, then simple class design, and finally the more difficult aspects of inheritance and polymorphism The author applies his spiral teaching approach throughout the text, and readers acquire a meaningful understanding of programming concepts and techniques This text sets the standard for today’s C# programming books; readers of all levels will benefit from the rich learning experience that this text provides Distinctive Features: 200 complete, fully annotated programs are included to provide concepts with a concrete embodiment that facilitates learning In addition to basic programming concepts, this text introduces data structures, threads, networking, database access, XML, Web programming, and Web services Readers can practice their skills through the following exercises: Test Your Understanding, Skill Builder, Critical Thinking, Debugging, Program Modification, Program Design, and more! Computing with C# and the NET Framework Art Gittleman World Headquarters Jones and Bartlett Publishers 40 Tall Pine Drive Sudbury, MA 01776 978-443-5000 info@jbpub.com www.jbpub.com Jones and Bartlett Publishers Canada 2406 Nikanna Road Mississauga, ON L5C 2W6 Jones and Bartlett Publishers International Barb House, Barb Mews London W6 7PA UK Copyright © 2003 by Art Gittleman Cover image © Ryan McVay / Getty Images All rights reserved No part of the material protected by this copyright may be reproduced or utilized in any form, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without written permission from the copyright owner Library of Congress Cataloging-in-Publication Data Gittleman, Art Computing with C# and the NET framework / Arthur Gittleman p cm ISBN 0-7637-2339-8 C# (Computer program language) 2 Microsoft NET Framework I Title QA76.73.C154 G58 2003 005.13'3-dc21 2002040703 Editor-in-Chief, College: J Michael Stranz Production Manager: Amy Rose Associate Editor: Theresa DiDonato Associate Production Editor: Karen C Ferreira Senior Marketing Manager: Nathan J Schultz Production Assistant: Jenny L McIsaac Cover Design: Kristin E Ohlin Composition: Northeast Compositors Design: Anne's Books Printing and Binding: Courier Westford Cover Printing: Jaguar Advanced Graphics This book was typeset in QuarkXpress 4.1 on a Macintosh G4 The font families used were Times, Frutiger, and Impress The first printing was printed on 45# Highland Plus 07 06 05 04 03 10 To Charlotte with love Preface C# and the NET Framework support a new, integrated, powerful Internet programming model We no longer need to use Visual Basic for rapid application development and forms, C++ for object-oriented applications, and ASP for the Web We can use C# for all, and with the NET Framework we have a platform with a huge library that can integrate applications across the Internet This text teaches C# from the beginning, but includes enough material for a two-term course covering more advanced topics It teaches the concepts of computing necessary for a CS-1 course, but allows those with prior experience programming in another language to proceed quickly over the earlier chapters to learn the exciting C# language and NET Framework in depth Core topics include C# basics, control structures, types, object-oriented programming, and arrays Next come event-driven programming, user interfaces, and inheritance Additional topics include exception handling, files, data structures, threads, animation, networking, databases, web programming with ASP.NET, and XML and web services The later chapters can, for the most part, be studied independently, so an instructor has flexibility in the choice of topics for a more advanced course I believe one learns best from example, and, therefore, each chapter has many complete programs As programmers we learn to add comments to our code, but for pedagogical purposes where comments would be so detailed as to clutter the code, I prefer to use notes Each note contains a longer explanation of a key line of code, and appears just after the code, allowing easier reading of the code itself By using notes in this way, I also avoid cluttering the text with detailed code explanations and can focus on explaining concepts One also learns by doing To facilitate learning I include many varied exercises Test Your Understanding Exercises at the end of each section give readers a chance to assimilate the material immediately Answers to the odd-numbered exercises appear at the end of the text, and answers to the even-numbered exercises are available with code for all program examples on a Student Resource CD included with the text This CD also includes the NET framework SDK I include Skill Builder and Critical Thinking exercises at the end of most chapters to allow readers to master new concepts Answers to these appear at the end of the book A debugging exercise at the end of most chapters helps develop this necessary skill Program Modification exercises allow readers to tackle this common task Program Design exercises provide practice including the entire development process One can debate endlessly the best way to introduce objects I like to present objects early, but using a spiral approach so students build a sound foundation before delving into the details Thus I start with an intuitive example in Chapter 5 and continue to show, using UML, how to design a class and code it in C# I defer some concepts to Chapter 6, and the more difficult inheritance concepts to Chapter 9 I thank reviewers Gerald Baumgartner, The Ohio State University David Binkley, Loyola College Corinne Hoisington, Central Virginia Community College Kenrick Mock, University of Alaska Anchorage for their many perceptive comments and suggestions that did much to improve the manuscript It has bee a great pleasure working with the very helpful and amiable CS team at Jones and Bartlett, including Michael Stranz, Theresa DiDonato, Amy Rose, Jenny McIsaac, and Karen Ferreira The web site for this book is http://computerscience.jbpub.com/csharp I will post errata as soon as I become aware of them Please email any corrections to me at artg@csulb.edu Chapter 1: An Introduction to Computing with C# Download CD Content Chapter 7: Arrays Example 7.1: TryArray.cs Example 7.2: ReverseArray.cs The BIG Picture Example 7.3: ReverseInputArray.cs Example 7.4: ArrayCopy.cs The BIG Picture Example 7.5: TryObjectArray.cs Example 7.6: Dice.cs The BIG Picture Example 7.7: StudentScoreMulti.cs Example 7.8: StudentScore.cs The BIG Picture Example 7.9: InsertionSort.cs Example 7.10: InsertionSortTiming.cs The BIG Picture Chapter 8: Event-Driven Programming Example 8.1: HelloCount.cs The BIG Picture Example 8.2: DrawFill.cs The BIG Picture Example 8.3: Text.cs The BIG Picture Example 8.4: ColorChips.cs The BIG Picture Example 8.5: TryMouse.cs Example 8.6: TryKey.cs The BIG Picture Example 8.7: TangramSolver.cs The BIG Picture Chapter 9: User Interfaces Example 9.1: ButtonPress.cs Example 9.2: Compute.cs The BIG Picture Example 9.3: EnterPrice.cs Example 9.4: Select.cs Example 9.5: SelectItem.cs Example 9.6: ListText.cs The BIG Picture Example 9.7: Form1.cs The BIG Picture Example 9.8: InsertA.cs Example 9.9: InsertB.cs Example 9.10: InsertC.cs Example 9.11: InsertD.cs The BIG Picture Chapter 10: Inheritance Example 10.1: SimpleSavings1.cs Example 10.2: UseSimpleSavings1.cs Example 10.3: SimpleSavings2.cs Example 10.4: UseSimpleSavings2.cs Example 10.5: SavingsAccount.cs Example 10.6: UseSavingsAccount.cs Example 10.7: CheckingAccount.cs Example 10.8: UseCheckingAccount.cs The BIG Picture Example 10.9: Animal.cs, Lion.cs, Giraffe.cs, UseAnimals.cs Example 10.10: Duck.cs, UseNewAnimal.cs Example 10.11: Withdraw.cs The BIG Picture Example 10.12: Shape.cs Example 10.13: Line.cs, Circle.cs, UseShapes.cs The BIG Picture Example 10.14: A.cs Example 10.15: C.cs Example 10.16: D.cs The BIG Picture Example 10.17: AtmScreen.cs The BIG Picture Chapter 11: Exception Handling and Input/Output Example 11.1: PassArguments.cs Example 11.2: Abort.cs Example 11.3: ValidateInput.cs Example 11.4: TryException.cs Example 11.5: TryExceptionTrace.cs Example 11.6: StringToNumber.cs The BIG Picture Example 11.7: IoError.cs Example 11.8: FileReadStrings.cs Example 11.9: FileReadAddresses.cs Example 11.10: Prices.cs The BIG Picture Example 11.11: FileProperties.cs Example 11.12: ReadBytes.cs Example 11.13: Binary.cs Example 11.14: RandomAccess.cs The BIG Picture Example 11.15: MenuDialog.cs The BIG Picture Chapter 12: Data Structures Example 12.1: Journey.cs Example 12.2: SumPrices.cs Example 12.3: BinarySearch.cs Example 12.4: MergeSort.cs The BIG Picture Example 12.5: LinkedList.cs The BIG Picture Example 12.6: Stack.cs Example 12.7: Queue.cs The BIG Picture Example 12.8: ListMethods.cs Example 12.9: Fibonacci.cs Example 12.10: ArrayListTiming.cs The BIG Picture Example 12.11: HashValues.cs Example 12.12: HashPut.cs Example 12.13: RiverMap.cs The BIG Picture Example 12.14: BadCompare.cs Example 12.15: NewName.cs Example 12.16: GoodCompare.cs Example 12.17: NewOrderedName.cs Example 12.18: Ordering.cs The BIG Picture Chapter 13: Threads and Animation Example 13.1: NameUsingThread.cs Example 13.2: NameBusy.cs The BIG Picture Example 13.3: ButtonToMove.cs Example 13.4: MoveBall.cs Example 13.5: AnimateBall.cs Example 13.6: AnimateFace.cs The BIG Picture Example 13.7: AnimateImage.cs The BIG Picture Example 13.8: TallyWrong.cs Example 13.9: TallyRight.cs Example 13.10: PutGet.cs Example 13.11: Deadlock.cs The BIG Picture Chapter 14: Networking Example 14.1: TryURL.cs Example 14.2: TryWebRequest.cs Example 14.3: TryHttpRequest.cs The BIG Picture Example 14.4: TryTcp.cs Example 14.5: ReverseServer.cs Example 14.6: ReverseClient.cs The BIG Picture Example 14.7: VerySimpleBrowser Example 14.8: VerySimpleWebServer.cs Example 14.9: ThreadedWebServer.cs The BIG Picture Example 14.10: Fortune.cs Example 14.11: FortuneImpl.cs Example 14.12: FortuneServer.cs Example 14.13: FortuneClient.cs The BIG Picture Chapter 15: Using a Database The BIG Picture Example 15.1: Connect.cs Example 15.2: Create.cs The BIG Picture Example 15.3: ExtractInfo.cs The BIG Picture Example 15.4: DatabaseInfo.cs The BIG Picture Example 15.5: Prepare.cs Example 15.6: Transact.cs The BIG Picture Example 15.7: Form1.cs The BIG Picture Chapter 16: ASP.NET Example 16.1: AWebPage.html The BIG Picture Example 16.2: GetOrder.aspx Example 16.3: GetOrderBehind.aspx Example 16.4: GetOrderBehind.aspx.cs Example 16.5: PostOrder.aspx Example 16.6: PostOrder.aspx.cs The BIG Picture Example 16.7: Sales.aspx Example 16.8: Sales.aspx.cs The BIG Picture Example 16.9: SessionOrder.aspx Example 16.10: SessionOrder.aspx.cs The BIG Picture Chapter 17: XML and Web Services The BIG Picture Example 17.1: Dom.cs Example 17.2: MakeXml.cs The BIG Picture Example 17.3: XmlToHtml.cs The BIG Picture Example 17.4: TestWeb.cs Example 17.5: ReverseService.asmx CD Content Following are select files from this book's Companion CD-ROM These files are for your personal use, are governed by the Books24x7 Membership Agreement, and are copyright protected by the publisher, author, and/or other third parties Unauthorized use, reproduction, or distribution is strictly prohibited Click on the link(s) below to download the files to your computer: File Description All CD Content Computing with C# and the NET Framework Size 561,385 Chapter 1: An Introduction to Computing with C# 18,489 Chapter 2: C# Programming Basics 29,744 Chapter 3: Software Engineering with Control Structures 29,037 Chapter 4: More Control Structures and Types 27,351 Chapter 5: Getting Started with Object-Oriented Programming 10,457 Chapter 6: Working with Objects 26,303 Chapter 7: Arrays 24,495 Chapter 8: Event-Driven Programming 18,508 Chapter 9: User Interfaces 62,335 Chapter 10: Inheritance 51,888 Chapter 11: 33,211 Exception Handling and Input/Output Chapter 12: Data Structures 50,332 Chapter 13: Threads and Animation 44,257 Chapter 14: Networking 30,630 Chapter 15: Using a Database 60,435 Chapter 16: ASP.NET 14,953 Chapter 17: XML and Web Services 37,067 ... approach A version of C+ +, called managed C+ +, adapts C+ + to work with the CLR, so C+ + programmers can integrate code with other CLR users We call code that uses the CLR managed code The Common Type... This text presents only a small part of the NET Framework, but we cannot climb the mountain until we take the first steps The two main parts of the NET Framework are the Common Language Runtime and the NET Framework class library The Common Language Runtime... The BIG Picture C# was created in the twenty-first century, basing much syntax on C and C+ + and using concepts from several other languages It combines the rapid productivity of Visual Basic with the power of C+ +

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

Mục lục

  • Table of Contents

  • BackCover

  • Computing with C# and the .NET Framework

  • Preface

  • Chapter 1: An Introduction to Computing with C#

    • 1.1 Introduction to Computing

    • 1.2 The .NET Framework

    • 1.3 Overview of C#

    • 1.4 The Elements of a C# Program

    • 1.5 Compiling and Running C# Programs

    • 1.6 Developing a C# Program

    • Summary

    • Chapter 2: C# Programming Basics

      • 2.1 Variables

      • 2.2 Assignment

      • 2.3 Input and Output

      • 2.4 Arithmetic Expressions

      • 2.5 Methods and Parameters

      • Summary

      • Chapter 3: Software Engineering with Control Structures

        • 3.1 Relational Operators and Expressions

        • 3.2 if and if-else Statements

        • 3.3 The Type double

Tài liệu cùng người dùng

Tài liệu liên quan