HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
The professional programmer’s Deitel® guide to C# 2012 and object-oriented development for Windows® 7 and Windows® 8
Written 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® 8 UI and WPF graphics and multimedia, web services, Windows® Phone 8, Windows Azure™ and more. You’ll enjoy the treatment of object-oriented programming and an OOD/UML® 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®, C++, Visual C++®, C, Java™, Android™ app development, iOS® app development, Internet and web programming, JavaScript®, XML, Perl®, 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® ATM Case Study
• WinForms, WPF, Windows® 8 UI, XAML, Event Handling, Visual C# Debugging
• WPF and Windows® 8 Graphics and Multimedia
• Windows® Phone 8, Cloud Computing with Windows Azure™, 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.com
Preface xxiii
Before You Begin xxxi
Chapter 1: Introduction 1
1.1 Introduction 2
1.2 Object Technology 2
1.3 C# 5 Object-Oriented Programming 5
1.4 Microsoft’s .NET 6
1.5 Microsoft’s Windows® Operating System 8
1.6 Windows Phone 8 for Smartphones 9
1.7 Windows Azure™and Cloud Computing 11
1.8 Visual Studio Express 2012 Integrated Development Environment 11
1.9 Painter Test-Drive in Visual Studio Express 2012 for Windows Desktop 11
1.10 Painter Test-Drive in Visual Studio Express 2012 for Windows 8 15
Chapter 2: Dive Into® Visual Studio Express 2012 for Windows Desktop 20
2.1 Introduction 21
2.2 Overview of the Visual Studio Express 2012 IDE 21
2.3 Menu Bar and Toolbar 26
2.4 Navigating the Visual Studio IDE 28
2.5 Using Help 33
2.6 Using Visual App Development to Create a Simple App that Displays Text and an Image 34
2.7 Wrap-Up 44
2.8 Web Resources 45
Chapter 3: Introduction to C# Apps 46
3.1 Introduction 47
3.2 ASimple C# App: Displaying a Line of Text 47
3.3 Creating a Simple App in Visual Studio 52
3.4 Modifying Your Simple C# App 58
3.5 Formatting Text with Console.Write and Console.WriteLine 60
3.6 Another C# App: Adding Integers 61
3.7 Arithmetic 65
3.8 Decision Making: Equality and Relational Operators 67
3.9 Wrap-Up 71
Chapter 4: Introduction to Classes, Objects, Methods and strings 72
4.1 Introduction 73
4.2 Classes, Objects, Methods, Properties and Instance Variables 73
4.3 Declaring a Class with a Method and Instantiating an Object of a Class 74
4.4 Declaring a Method with a Parameter 78
4.5 Instance Variables and Properties 82
4.6 UML Class Diagram with a Property 86
4.7 Software Engineering with Properties and set and get Accessors 87
4.8 Auto-Implemented Properties 88
4.9 Value Types vs. Reference Types 89
4.10 Initializing Objects with Constructors 90
4.11 Floating-Point Numbers and Type decimal 93
4.12 Wrap-Up 99
Chapter 5: Control Statements: Part 1 101
5.1 Introduction 102
5.2 Control Structures 102
5.3 if Single-Selection Statement 104
5.4 if…else Double-Selection Statement 105
5.5 while Repetition Statement 109
5.6 Counter-Controlled Repetition 110
5.7 Sentinel-Controlled Repetition 113
5.8 Nested Control