Brief Contents......Page 6 Contents......Page 7 Preface......Page 16 CHAPTER 1: A First Program Using C#......Page 28 The Programming Process......Page 29 Procedural and Object-Oriented Programming......Page 31 Features of Object-Oriented Programming Languages......Page 34 The C# Programming Language......Page 36 Writing a C# Program that Produces Output......Page 38 Selecting Identifiers......Page 41 Adding Program Comments......Page 45 Using the System Namespace......Page 46 Compiling and Executing a C# Program......Page 50 Compiling Code from the Command Prompt......Page 51 Compiling Code Using the Visual Studio IDE......Page 53 Noticing the Differences Between the Programs in the Text Editor and the IDE......Page 56 Deciding Which Environment to Use......Page 57 Key Terms......Page 65 Review Questions......Page 69 Exercises......Page 71 CHAPTER 2: Using Data......Page 74 Declaring Variables......Page 75 Displaying Variable Values......Page 79 Variable Alignment......Page 82 Using the Integral Data Types......Page 83 Using Floating-Point Data Types......Page 86 Formatting Floating-Point Values......Page 87 Using Arithmetic Operators......Page 90 Using Shortcut Arithmetic Operators......Page 91 Using the bool Data Type......Page 95 Understanding Numeric Type Conversion......Page 98 Using the char Data Type......Page 101 Using the string Data Type......Page 103 Defining Named Constants......Page 107 Working with Enumerations......Page 108 Using the Convert Class......Page 111 Using the Parse() Methods......Page 113 Chapter Summary......Page 116 Key Terms......Page 117 Review Questions......Page 120 Exercises......Page 123 CHAPTER 3: Using GUI Objects and the Visual Studio IDE......Page 126 Creating a Form in the IDE......Page 127 Using the Toolbox to Add a Button to a Form......Page 132 Adding Functionality to a Button on a Form......Page 134 Adding Labels and TextBoxes to a Form......Page 136 Understanding Focus and Tab Control......Page 139 Formatting Data in GUI Applications......Page 140 Naming Forms and Controls......Page 141 Correcting Errors......Page 143 Deleting an Unwanted Event-Handling Method......Page 144 Using Visual Studio Help......Page 145 Deciding Which Interface to Use......Page 146 Chapter Summary......Page 152 Key Terms......Page 153 Review Questions......Page 154 Exercises......Page 157 CHAPTER 4: Making Decisions......Page 160 Understanding Logic-Planning Tools and Decision Making......Page 161 Making Decisions Using the if Statement......Page 164 A Note on Equivalency Comparisons......Page 170 Making Decisions Using the if-else Statement......Page 172 Using the Conditional AND Operator......Page 177 Using the Conditional OR Operator......Page 179 Using the Logical AND and OR Operators......Page 180 Combining AND and OR Operators......Page 181 Making Decisions Using the switch Statement......Page 186 Using an Enumeration with a switch Statement......Page 189 Using the Conditional Operator......Page 191 Using the NOT Operator......Page 192 Performing Accurate and Efficient Range Checks......Page 194 Using the ! Operator Correctly......Page 196 Decision-Making Issues in GUI Programs......Page 198 Key Terms......Page 202 Review Questions......Page 204 Exercises......Page 208 CHAPTER 5: Looping......Page 212 Creating Loops with the while Statement......Page 213 Creating Loops with the for Statement......Page 222 Creating Loops with the do Statement......Page 225 Using Nested Loops......Page 227 Accumulating Totals......Page 233 Avoiding Unnecessary Operations......Page 235 Considering the Order of Evaluation of Short-Circuit Operators......Page 236 Using Prefix Incrementing Rather Than Postfix Incrementing......Page 237 Looping Issues in GUI Programs......Page 239 Chapter Summary......Page 242 Key Terms......Page 243 Review Questions......Page 244 Exercises......Page 247 CHAPTER 6: Using Arrays......Page 250 Declaring an Array and Assigning Values......Page 251 Initializing an Array......Page 253 Accessing Array Elements......Page 255 Using the Length Property......Page 256 Using foreach......Page 257 Searching an Array Using a Loop......Page 260 Using a for Loop to Search an Array......Page 261 Improving a Loop’s Efficiency......Page 263 Using a while Loop to Search an Array......Page 264 Searching an Array for a Range Match......Page 266 Using the BinarySearch() Method......Page 268 Using the Sort() Method......Page 270 Using the Reverse() Method......Page 271 Using Multidimensional Arrays......Page 274 Using Jagged Arrays......Page 278 Array Issues in GUI Programs......Page 280 Key Terms......Page 282 Review Questions......Page 283 Exercises......Page 286 CHAPTER 7: Using Methods......Page 292 Understanding Methods and Implementation Hiding......Page 293 Understanding Implementation Hiding......Page 294 Writing Methods with No Parameters and No Return Value......Page 295 An Introduction to Accessibility......Page 296 An Introduction to the Optional static Modifier......Page 297 Understanding the Method Identifier......Page 298 Placing a Method in a Class......Page 299 Declaring Variables and Constants in a Method......Page 300 Writing Methods That Require a Single Argument......Page 303 Writing Methods That Require Multiple Arguments......Page 307 Writing Methods That Return a Value......Page 309 Writing a Method That Returns a Boolean Value......Page 311 Analyzing a Built-In Method......Page 312 Passing a Single Array Element to a Method......Page 316 Passing an Array to a Method......Page 317 Writing a Main() Method with a Parameter List......Page 320 Writing a Main() Method with public Access......Page 321 Understanding Methods That Are Generated Automatically in the Visual Environment......Page 322 Creating Methods to be Nonstatic When Associated with a Form......Page 323 Chapter Summary......Page 324 Key Terms......Page 325 Review Questions......Page 327 Exercises......Page 330 CHAPTER 8: Advanced Method Concepts......Page 334 Using Mandatory Value Parameters......Page 335 Passing Parameters by Reference......Page 337 Using a ref Parameter......Page 338 Using an out Parameter......Page 339 Deciding Between out and ref......Page 340 Using a Built-in Method That Has an out Parameter......Page 341 Using Parameter Arrays......Page 343 Returning a Reference from a Method......Page 346 Overloading Methods......Page 349 Understanding Overload Resolution......Page 353 Discovering Built-In Overloaded Methods......Page 354 Avoiding Ambiguous Methods......Page 357 Using Optional Parameters......Page 359 Leaving Out Unnamed Arguments......Page 361 Using Named Arguments......Page 362 Advantages to Using Named Arguments......Page 363 Disadvantages to Using Named Arguments......Page 364 Overload Resolution with Named and Optional Arguments......Page 366 Key Terms......Page 368 Review Questions......Page 369 Exercises......Page 373 CHAPTER 9: Using Classes and Objects......Page 378 Understanding Class Concepts......Page 379 Creating a Class from Which Objects Can Be Instantiated......Page 381 Creating Instance Variables and Methods......Page 382 Creating Objects......Page 384 Passing Objects to Methods......Page 387 Creating Properties......Page 388 Using Auto-Implemented Properties......Page 392 More About public and private Access Modifiers......Page 398 Understanding the this Reference......Page 402 Understanding Constructors......Page 405 Passing Parameters to Constructors......Page 406 Overloading Constructors......Page 407 Using Constructor Initializers......Page 409 Using the readonly Modifier in a Constructor......Page 411 Using Object Initializers......Page 413 Overloading Operators......Page 417 Declaring an Array of Objects......Page 422 Using the Sort() and BinarySearch() Methods with Arrays of Objects......Page 423 Understanding Destructors......Page 430 Understanding GUI Application Objects......Page 432 Chapter Summary......Page 434 Key Terms......Page 436 Review Questions......Page 438 Exercises......Page 441 CHAPTER 10: Introduction to Inheritance......Page 448 Understanding Inheritance......Page 449 Understanding Inheritance Terminology......Page 451 Extending Classes......Page 453 Using the protected Access Specifier......Page 459 Overriding Base Class Members......Page 463 Accessing Base Class Methods and Properties from a Derived Class......Page 466 Understanding Implicit Reference Conversions......Page 472 Using the Object Class......Page 473 Using the Object Class’s ToString() Method......Page 475 Using the Object Class’s Equals() Method......Page 476 Using the Object Class’s GetHashCode() Method......Page 477 Working with Base Class Constructors......Page 479 Using Base Class Constructors That Require Arguments......Page 480 Creating and Using Abstract Classes......Page 483 Creating and Using Interfaces......Page 487 Using Extension Methods......Page 492 Recognizing Inheritance in GUI Applications......Page 494 Chapter Summary......Page 497 Key Terms......Page 498 Review Questions......Page 500 Exercises......Page 503 CHAPTER 11: Exception Handling......Page 510 Understanding Exceptions......Page 511 Purposely Generating a SystemException......Page 513 Comparing Traditional and Object-Oriented Error-Handling Methods......Page 518 Understanding Object-Oriented Exception-Handling Methods......Page 519 Using the Exception Class’s ToString() Method and Message Property......Page 523 Catching Multiple Exceptions......Page 528 Examining the Structure of the TryParse() Methods......Page 533 Using the finally Block......Page 535 Handling Exceptions Thrown from Outside Methods......Page 538 Tracing Exception Objects Through the Call Stack......Page 541 A Case Study: Using StackTrace......Page 542 Creating Your Own Exception Classes......Page 546 Rethrowing an Exception......Page 550 Chapter Summary......Page 552 Key Terms......Page 553 Review Questions......Page 554 Exercises......Page 558 CHAPTER 12: Using Controls......Page 562 Understanding Controls......Page 563 Examining the IDE’s Automatically Generated Code......Page 568 Setting a Control’s Font......Page 572 Using a LinkLabel......Page 575 Adding Color to a Form......Page 579 Using CheckBox and RadioButton Objects......Page 586 Adding a PictureBox to a Form......Page 590 Adding ListBox, CheckedListBox, and ComboBox Controls to a Form......Page 593 Adding MonthCalendar and DateTimePicker Controls to a Form......Page 598 Working with a Form’s Layout......Page 602 Understanding GroupBoxes and Panels......Page 604 Adding a MenuStrip to a Form......Page 605 Using Other Controls......Page 607 Chapter Summary......Page 617 Review Questions......Page 618 Exercises......Page 621 CHAPTER 13: Handling Events......Page 624 Event Handling......Page 625 Understanding Delegates......Page 629 Creating Composed Delegates......Page 632 Declaring and Using Both Custom and Built-in Event Handlers......Page 638 Using the Built-in EventHandler......Page 641 Handling Control Component Events......Page 648 Handling Mouse Events......Page 653 Handling Keyboard Events......Page 655 Defining Focus......Page 658 Handling Multiple Events with a Single Handler......Page 659 Continuing to Learn about Controls and Events......Page 660 Chapter Summary......Page 663 Key Terms......Page 664 Review Questions......Page 665 Exercises......Page 668 CHAPTER 14: Files and Streams......Page 672 Files and the File and Directory Classes......Page 673 Using the File and Directory Classes......Page 675 Understanding File Data Organization......Page 679 Understanding Streams......Page 681 Writing Data to a Sequential Access Text File......Page 685 Reading from a Sequential Access Text File......Page 688 Searching a Sequential Text File......Page 694 Understanding Serialization and Deserialization......Page 700 Chapter Summary......Page 713 Key Terms......Page 714 Review Questions......Page 716 Exercises......Page 719 Appendix A: Operator Precedence and Associativity......Page 722 Key Terms......Page 723 Appendix B: Understanding Numbering Systems and Computer Codes......Page 724 The Hexadecimal System......Page 730 Measuring Storage......Page 731 Key Terms......Page 733 Providing Completion Lists......Page 734 Providing Quick Information......Page 735 Squiggles and Lightbulbs......Page 736 Key Terms......Page 737 Glossary......Page 738 Index......Page 756 Guide beginning programmers through the fundamentals of the C# language using its most recent features with Farrell's MICROSOFT VISUAL C# 2017: AN INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING, 7E. Approachable examples and a clear presentation help students build a strong background in both structured and object-oriented programming concepts. Students master critical fundamental skills that easily transfer to other programming languages. This edition incorporates the most recent versions of both C# and Visual Studio to ensure students have the latest skills necessary for professional success. Hands-on features, video lessons, new debugging exercises, programming exercises, and running case studies keep students actively engaged. Now available with MindTap, the digital learning solution that powers students from memorization to mastery. Give your students hands-on skill practice with auto-graded lab assignments in a live integrated development environment directly within MindTap. A full selection of instructor support provides the tools to reinforce the solid programming skills your students need. Develop the strong programming skills you need for professional success with Farrell's MICROSOFT® VISUAL C# 2017: AN INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING, 7E. Approachable examples and a clear, straightforward style help you build a solid understanding of both structured and object-oriented programming concepts. You master critical principles and techniques that easily transfer to other programming languages. This new edition incorporates the most recent versions of both C# and Visual Studio 2017 to ensure you have the contemporary skills required in business today. Short'You Do It'hands-on features; video lessons for each chapter; and a variety of new debugging exercises, programming exercises, and running case studies help prepare you for success in today's programming environment. New MindTap online resource offers coding labs and additional assessment, in addition to a full eReader. Discover the tools and expertise you need for programming success.