- ホーム
- > 洋書
- > 英文書
- > Computer / Languages
Full Description
The professional programmer's Deitel (R) guide to C# 2012 and object-oriented development for Windows (R) 7 and Windows (R) 8Written for programmers with a background in high-level language programming, this book applies the Deitel signature live-code approach to teaching programming and explores Microsoft's C# 2012 and .NET 4.5 in depth. The book presents the concepts in the context of fully tested apps, complete with syntax shading, code highlighting, code walkthroughs and program outputs. You'll work through 200+ complete C# apps with 15,000+ lines of proven C# code and hundreds of savvy software-development tips.Start with an introduction to C# using an early classes and objects approach, then rapidly move on to more advanced topics, including LINQ, asynchronous programming with async and await, Windows (R) 8 UI and WPF graphics and multimedia, web services, Windows (R) Phone 8, Windows Azure (TM) and more. You'll enjoy the treatment of object-oriented programming and an OOD/UML (R) ATM case study, including a complete C# implementation. When you're finished, you'll have everything you need to build industrial-strength, object-oriented C# apps.Paul Deitel and Harvey Deitel are the founders of Deitel & Associates, Inc., the internationally recognized programming languages authoring and corporate-training organization. Millions of people worldwide have used Deitel books, LiveLessons video training and online resource centers to master C#, .NET, Visual Basic (R), C++, Visual C++ (R), C, Java (TM), Android (TM) app development, iOS (R) app development, Internet and web programming, JavaScript (R), XML, Perl (R), Python and more. Practical, example-rich coverage of:* .NET, Types, Arrays, Exception Handling* LINQ, Object/Collection Initializers* Objects, Classes, Inheritance, Polymorphism* Industrial-Strength, C#-Based Object-Oriented Design/UML (R) ATM Case Study* WinForms, WPF, Windows (R) 8 UI, XAML, Event Handling, Visual C# Debugging* WPF and Windows (R) 8 Graphics and Multimedia* Windows (R) Phone 8, Cloud Computing with Windows Azure (TM), Asynchronous Programming with async and await * Generic Collections, Methods and Classes* XML, LINQ to XML and LINQ to Entities* ASP.NET and ASP.NET Ajax* Web Forms, Web Controls* WCF REST-Based Web Services and more.Visit www.deitel.comFor information on Deitel's Dive Into (R) Series programming training courses delivered at organizations worldwide visit www.deitel.com/training or write to deitel@deitel.com Download code examples Join the Deitel social networking communities on Facebook (R) at facebook.com/DeitelFan, Twitter (R) @deitel, Google+ (TM) at gplus.to/deitel and LinkedIn (R) at bit.ly/DeitelLinkedIn. To receive updates for this book, subscribe to the Deitel (R) Buzz Online e-mail newsletter at www.deitel.com/newsletter/ subscribe.html
Contents
Preface xxiiiBefore You Begin xxxiChapter 1: Introduction 11.1 Introduction 21.2 Object Technology 21.3 C# 5 Object-Oriented Programming 51.4 Microsoft's .NET 61.5 Microsoft's Windows (R) Operating System 81.6 Windows Phone 8 for Smartphones 91.7 Windows Azure (TM)and Cloud Computing 111.8 Visual Studio Express 2012 Integrated Development Environment 111.9 Painter Test-Drive in Visual Studio Express 2012 for Windows Desktop 111.10 Painter Test-Drive in Visual Studio Express 2012 for Windows 8 15Chapter 2: Dive Into (R) Visual Studio Express 2012 for Windows Desktop 202.1 Introduction 212.2 Overview of the Visual Studio Express 2012 IDE 212.3 Menu Bar and Toolbar 262.4 Navigating the Visual Studio IDE 282.5 Using Help 332.6 Using Visual App Development to Create a Simple App that Displays Text and an Image 342.7 Wrap-Up 442.8 Web Resources 45Chapter 3: Introduction to C# Apps 463.1 Introduction 473.2 ASimple C# App: Displaying a Line of Text 473.3 Creating a Simple App in Visual Studio 523.4 Modifying Your Simple C# App 583.5 Formatting Text with Console.Write and Console.WriteLine 603.6 Another C# App: Adding Integers 613.7 Arithmetic 653.8 Decision Making: Equality and Relational Operators 673.9 Wrap-Up 71Chapter 4: Introduction to Classes, Objects, Methods and strings 724.1 Introduction 734.2 Classes, Objects, Methods, Properties and Instance Variables 734.3 Declaring a Class with a Method and Instantiating an Object of a Class 744.4 Declaring a Method with a Parameter 784.5 Instance Variables and Properties 824.6 UML Class Diagram with a Property 864.7 Software Engineering with Properties and set and get Accessors 874.8 Auto-Implemented Properties 884.9 Value Types vs. Reference Types 894.10 Initializing Objects with Constructors 904.11 Floating-Point Numbers and Type decimal 934.12 Wrap-Up 99Chapter 5: Control Statements: Part 1 1015.1 Introduction 1025.2 Control Structures 1025.3 if Single-Selection Statement 1045.4 if...else Double-Selection Statement 1055.5 while Repetition Statement 1095.6 Counter-Controlled Repetition 1105.7 Sentinel-Controlled Repetition 1135.8 Nested Control Statements 1185.9 Compound Assignment Operators 1215.10 Increment and Decrement Operators 1225.11 Simple Types 1255.12 Wrap-Up 125Chapter 6: Control Statements: Part 2 1266.1 Introduction 1276.2 Essentials of Counter-Controlled Repetition 1276.3 for Repetition Statement 1286.4 Examples Using the for Statement 1326.5 do...while Repetition Statement 1366.6 switch Multiple-Selection Statement 1376.7 break and continue Statements 1456.8 Logical Operators 1476.9 Wrap-Up 153Chapter 7: Methods: A Deeper Look 1547.1 Introduction 1557.2 Packaging Code in C# 1557.3 static Methods, static Variables and Class Math 1567.4 Declaring Methods with Multiple Parameters 1587.5 Notes on Declaring and Using Methods 1627.6 Method-Call Stack and Activation Records 1637.7 Argument Promotion and Casting 1637.8 The .NET Framework Class Library 1657.9 Case Study: Random-Number Generation 1677.10 Case Study: A Game of Chance; Introducing Enumerations 1727.11 Scope of Declarations 1777.12 Method Overloading 1797.13 Optional Parameters 1827.14 Named Parameters 1837.15 Recursion 1847.16 Passing Arguments: Pass-by-Value vs. Pass-by-Reference 1877.17 Wrap-Up 191Chapter 8: Arrays; Introduction to Exception Handling 1928.1 Introduction 1938.2 Arrays 1938.3 Declaring and Creating Arrays 1958.4 Examples Using Arrays 1968.5 Case Study: Card Shuffling and Dealing Simulation 2068.6 foreach Statement 2108.7 Passing Arrays and Array Elements to Methods 2128.8 Passing Arrays by Value and by Reference 2148.9 Case Study: GradeBook Using an Array to Store Grades 2188.10 Multidimensional Arrays 2238.11 Case Study: GradeBook Using a Rectangular Array 2288.12 Variable-Length Argument Lists 2348.13 Using Command-Line Arguments 2368.14 Wrap-Up 238Chapter 9: Introduction to LINQ and the List Collection 2399.1 Introduction 2409.2 Querying an Array of int Values Using LINQ 2419.3 Querying an Array of Employee Objects Using LINQ 2459.4 Introduction to Collections 2509.5 Querying a Generic Collection Using LINQ 2539.6 Wrap-Up 2559.7 Deitel LINQ Resource Center 255Chapter 10: Classes and Objects: A Deeper Look 25610.1 Introduction 25710.2 Time Class Case Study 25710.3 Controlling Access to Members 26110.4 Referring to the Current Object's Members with the this Reference 26210.5 Time Class Case Study: Overloaded Constructors 26410.6 Default and Parameterless Constructors 27010.7 Composition 27110.8 Garbage Collection and Destructors 27410.9 static Class Members 27510.10 readonly Instance Variables 27810.11 Data Abstraction and Encapsulation 27910.12 Class View and Object Browser 28110.13 Object Initializers 28310.14 Wrap-Up 283Chapter 11: Object-Oriented Programming: Inheritance 28511.1 Introduction 28611.2 Base Classes and Derived Classes 28711.3 protected Members 28911.4 Relationship between Base Classes and Derived Classes 29011.5 Constructors in Derived Classes 31311.6 Software Engineering with Inheritance 31411.7 Class object 31411.8 Wrap-Up 315Chapter 12: OOP: Polymorphism, Interfaces and Operator Overloading 31712.1 Introduction 31812.2 Polymorphism Examples 32012.3 Demonstrating Polymorphic Behavior 32112.4 Abstract Classes and Methods 32412.5 Case Study: Payroll System Using Polymorphism 32612.6 sealed Methods and Classes 34212.7 Case Study: Creating and Using Interfaces 34212.8 Operator Overloading 35312.9 Wrap-Up 356Chapter 13: Exception Handling: A Deeper Look 35813.1 Introduction 35913.2 Example: Divide by Zero without Exception Handling 36013.3 Example: Handling DivideByZeroExceptions and FormatExceptions 36313.4 .NET Exception Hierarchy 36813.5 finally Block 36913.6 The using Statement 37613.7 Exception Properties 37713.8 User-Defined Exception Classes 38113.9 Wrap-Up 385Chapter 14: Graphical User Interfaces with Windows Forms: Part 1 38614.1 Introduction 38714.2 Windows Forms 38814.3 Event Handling 39014.4 Control Properties and Layout 39714.5 Labels, TextBoxes and Buttons 40114.6 GroupBoxes and Panels 40414.7 CheckBoxes and RadioButtons 40714.8 PictureBoxes 41514.9 ToolTips 41714.10 NumericUpDown Control 41914.11 Mouse-Event Handling 42114.12 Keyboard-Event Handling 42414.13 Wrap-Up 427Chapter 15: Graphical User Interfaces with Windows Forms: Part 2 42815.1 Introduction 42915.2 Menus 42915.3 MonthCalendar Control 43815.4 DateTimePicker Control 43915.5 LinkLabel Control 44215.6 ListBox Control 44615.7 CheckedListBox Control 45015.8 ComboBox Control 45315.9 TreeView Control 45715.10 ListView Control 46215.11 TabControl Control 46815.12 Multiple Document Interface (MDI) Windows 47315.13 Visual Inheritance 48015.14 User-Defined Controls 48515.15 Wrap-Up 489Chapter 16: Strings and Characters: A Deeper Look 49016.1 Introduction 49116.2 Fundamentals of Characters and Strings 49216.3 string Constructors 49316.4 string Indexer, Length Property and CopyTo Method 49416.5 Comparing strings 49516.6 Locating Characters and Substrings in strings 49816.7 Extracting Substrings from strings 50116.8 Concatenating strings 50216.9 Miscellaneous string Methods 50316.10 Class StringBuilder 50416.11 Length and Capacity Properties, EnsureCapacity Method and Indexer of Class StringBuilder 50516.12 Append and AppendFormat Methods of Class StringBuilder 50716.13 Insert, Remove and Replace Methods of Class StringBuilder 50916.14 Char Methods 51216.15 (Online) Introduction to Regular Expressions 51416.16 Wrap-Up 515Chapter 17: Files and Streams 51617.1 Introduction 51717.2 Data Hierarchy 51717.3 Files and Streams 51917.4 Classes File and Directory 52017.5 Creating a Sequential-Access Text File 52917.6 Reading Data from a Sequential-Access Text File 53817.7 Case Study: Credit Inquiry Program 54217.8 Serialization 54817.9 Creating a Sequential-Access File Using Object Serialization 54917.10 Reading and Deserializing Data from a Binary File 55317.11 Wrap-Up 555Chapter 18: Generics 55718.1 Introduction 55818.2 Motivation for Generic Methods 55918.3 Generic-Method Implementation 56118.4 Type Constraints 56418.5 Overloading Generic Methods 56618.6 Generic Classes 56718.7 Wrap-Up 576Chapter 19: Collections 57719.1 Introduction 57819.2 Collections Overview 57819.3 Class Array and Enumerators 58119.4 Nongeneric Collections 58419.5 Generic Collections 59619.6 Covariance and Contravariance for Generic Types 60319.7 Wrap-Up 606Chapter 20: Databases and LINQ 60720.1 Introduction 60820.2 Relational Databases 60920.3 A Books Database 61020.4 LINQ to Entities and the ADO.NET Entity Framework 61420.5 Querying a Database with LINQ 61520.6 Dynamically Binding Query Results 62720.7 Retrieving Data from Multiple Tables with LINQ 63220.8 Creating a Master/Detail View App 63720.9 Address Book Case Study 64120.10 Tools and Web Resources 64720.11 Wrap-Up 647Chapter 21: Web App Development with ASP.NET 64921.1 Introduction 65021.2 Web Basics 65121.3 Multitier App Architecture 65221.4 Your First Web App 65421.5 Standard Web Controls: Designing a Form 66621.6 Validation Controls 67021.7 Session Tracking 67721.8 Case Study: Database-Driven ASP.NET Guestbook 68521.9 Case Study: ASP.NET AJAX 69321.10 Case Study: Password-Protected Books Database App 69421.11 Wrap-Up 694Chapter 22: XML and LINQ to XML 69522.1 Introduction 69622.2 XML Basics 69622.3 Structuring Data 69922.4 XML Namespaces 70522.5 Document Type Definitions (DTDs) 70822.6 W3C XML Schema Documents 71122.7 Extensible Stylesheet Language and XSL Transformations 71922.8 LINQ to XML: Document Object Model (DOM) 72822.9 LINQ to XML Class Hierarchy 73122.10 LINQ to XML: Namespaces and Creating Documents 74022.11 XSLT with Class XslCompiledTransform 74422.12 Wrap-Up 746Chapter 23: Windows 8 UI and XAML 74723.1 Introduction 74823.2 Welcome App: Introduction to XAML Declarative GUI Programming 74923.3 Painter App: Layouts; Event Handling 75823.4 CoverViewer App: Data Binding, Data Templates and Styles 77123.5 App Lifecycle 77823.6 Wrap-Up 779Chapter 24: Windows 8 Graphics and Multimedia 78024.1 Introduction 78124.2 Basic Shapes 78224.3 Polylines and Polygons 78424.4 SolidColorBrushes and ImageBrushes 78624.5 GradientBrushes 78824.6 Transforms 79424.7 Windows 8 Customization: A Television GUI 79724.8 Wrap-Up 807Chapter 25: Building a Windows Phone 8 App 80825.1 Introduction 80925.2 Downloading the Windows Phone 8 SDK 81025.3 Tip Calculator App Introduction 81125.4 Test-Driving the Tip Calculator App 81225.5 Tip Calculator Technologies Overview 81225.6 Building the App's GUI 81325.7 Adding Functionality to the App with C# 82025.8 WMAppManifest.xml 82525.9 Windows Phone Dev Center 82525.10 Selling Your Apps in the Windows Phone Marketplace 82725.11 Other Popular Mobile App Platforms 82825.12 Developer Documentation 82925.13 Additional Windows Phone 8 Resources 82925.14 Wrap-Up 831Chapter 26: Asynchronous Programming with async and await 83226.1 Introduction 83326.2 Basics of async and await 83426.3 Executing an Asynchronous Task from a GUI App 83526.4 Sequential Execution of Two Compute-Intensive Tasks 83926.5 Asynchronous Execution of Two Compute-Intensive Tasks 84126.6 Invoking a Flickr Web Service Asynchronously with WebClient 84626.7 Wrap-Up 852Chapter 27: Web App Development with ASP.NET: A Deeper Look 85427.1 Introduction 85527.2 Case Study: Password-Protected Books Database App 85527.3 ASP.NET Ajax 87127.4 Wrap-Up 877Chapter 28: Web Services 87928.1 Introduction 88028.2 WCF Services Basics 88128.3 HTTP get and post Requests 88128.4 Representational State Transfer (REST) 88228.5 JavaScript Object Notation (JSON) 88228.6 Publishing and Consuming REST-Based XML Web Services 88328.7 Publishing and Consuming REST-Based JSON Web Services 88928.8 Equation Generator: Returning User-Defined Types 89328.9 Wrap-Up 905Chapter 29: Building a Windows Azure (TM) Cloud Computing App 90629.1 Introduction 90729.2 Installing the Windows Azure SDK for Visual Studio 2012 90929.3 Windows Azure Cloud Services Accounts 90929.4 Favorite Twitter Searches: Introduction 91029.5 Favorite Twitter Searches: Test-Drive 91129.6 Favorite Twitter Searches: Technologies Overview 91429.7 Favorite Twitter Searches: Code 91529.8 Security, Privacy and Reliability 92129.9 Microsoft Windows Azure Resources 92129.10 Microsoft Windows Azure Code Samples 92329.11 Additional Web Resources 92429.12 Wrap-Up 926Chapter 30: GUI with Windows Presentation Foundation 92730.1 Introduction 92830.2 Windows Presentation Foundation (WPF) 92830.3 Declarative GUI Programming Using XAML 92930.4 Creating a WPF App 93130.5 Laying Out Controls 93230.5.1 General Layout Principles 93330.5.2 Layout in Action 93430.6 Event Handling 93830.7 Commands and Common Application Tasks 94630.8 WPF GUI Customization 95130.9 Using Styles to Change the Appearance of Controls 95130.10 Customizing Windows 95730.11 Defining a Control's Appearance with Control Templates 96030.12 Data-Driven GUIs with Data Binding 96530.13 Wrap-Up 971Chapter 31: WPF Graphics and Multimedia 97231.1 Introduction 97331.2 Controlling Fonts 97331.3 Basic Shapes 97531.4 Polygons and Polylines 97731.5 Brushes 98031.6 Transforms 98731.7 WPF Customization: A Television GUI 98931.8 Animations 99931.9 Speech Synthesis and Speech Recognition 100131.10 Wrap-Up 1008Chapter 32: ATM Case Study, Part 1: Object-Oriented Design with the UML 100932.1 Introduction 101032.2 Examining the ATM Requirements Document 101032.3 Identifying the Classes in the ATM Requirements Document 101832.4 Identifying Class Attributes 102532.5 Identifying Objects' States and Activities 102932.6 Identifying Class Operations 103332.7 Identifying Collaboration Among Objects 104032.8 Wrap-Up 1047Chapter 33: ATM Case Study, Part 2: Implementing an Object-Oriented Design 105233.1 Introduction 105333.2 Starting to Program the Classes of the ATM System 105333.3 Incorporating Inheritance and Polymorphism into the ATM System 105833.4 ATM Case Study Implementation 106533.5 Wrap-Up 1089Appendix A: Operator Precedence Chart 1092Appendix B: Simple Types 1094Appendix C: ASCII Character Set 1096Appendix D: Number Systems 1097D.1 Introduction 1098D.2 Abbreviating Binary Numbers as Octal and Hexadecimal Numbers 1101D.3 Converting Octal and Hexadecimal Numbers to Binary Numbers 1102D.4 Converting from Binary, Octal or Hexadecimal to Decimal 1102D.5 Converting from Decimal to Binary, Octal or Hexadecimal 1103D.6 Negative Binary Numbers: Two's Complement Notation 1105Appendix E: UML 2: Additional Diagram Types 1107E.1 Introduction 1107E.2 Additional Diagram Types 1107Appendix F: Unicode (R) 1109F.1 Introduction 1110F.2 Unicode Transformation Formats 1111F.3 Characters and Glyphs 1112F.4 Advantages/Disadvantages of Unicode 1112F.5 Using Unicode 1113F.6 Character Ranges 1115Index 1117