Transcription of C# 6 for Programmers - pearsoncmg.com
1 C# 6 FOR PROGRAMMERSSIXTH EDITION DEITEL DEVELOPER SERIESMany of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained and/or its respective suppliers make no representations about the suitability of the information contained in the documents and related graphics published as part of the services for any purpose.
2 All such documents and related graphics are provided as is without warranty of any kind. Microsoft and/or its respective suppliers hereby disclaim all warranties and conditions with regard to this information, including all warranties and conditions of merchantabi-lity, whether express, implied or statutory, fitness for a particular purpose, title and non-infringement. In no event shall Microsoft and/or its respective suppliers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of information available from the documents and related graphics contained herein could include technical inaccuracies or typographical errors.
3 Changes are periodically added to the information herein. Microsoft and/or its respective suppliers may make improve-ments and/or changes in the product(s) and/or the program(s) described herein at any time. Partial screen shots may be viewed in full within the software version publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For government sales inquiries, please contact questions about sales outside the , please contact us on the Web: of Congress Control Number: 2016946157 Copyright 2017 Pearson Education, rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise.
4 For information regarding permissions, request forms and the appropriate contacts within the Pearson Education Global Rights & Permissions Department, please visit : 978-0-13-459632-7 ISBN-10: 0-13-459632-3 Text printed in the United States at RR Donnelley in Crawfordsville, printing, August 2016C# 6 FOR PROGRAMMERSSIXTH EDITION DEITEL DEVELOPER SERIESB oston Columbus Indianapolis New York San Francisco Amsterdam Cape TownDubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico CityS o Paulo Sydney Hong Kong Seoul Singapore Taipei TokyoPaul DeitelDeitel & Associates, DeitelDeitel & Associates, Series PageDeitel Developer SeriesAndroid 6 for Programmers : An App-Driven Approach, 3/EC for Programmers with an Introduction to C11C++11 for ProgrammersC# 6 for ProgrammersiOS 8 for Programmers : An App-Driven Approach with Swift Java for Programmers , 3/E JavaScript for ProgrammersSwift for ProgrammersHow To Program SeriesAndroid How to Program, 3/EC++ How to Program, 10/EC How to Program, 8/EJava How to Program, Early Objects Version, 10/EJava How to Program, Late Objects Version, 10/EInternet & World Wide Web How to Program, 5/EVisual Basic 2012 How to Program, 6/EVisual C# How to Program, 6/ESimply SeriesSimply Visual Basic 2010: An App-Driven Approach, 4/ESimply C++: An App-Driven Tutorial ApproachVitalSource Web Android How to Program, 2/E and 3/E C++ How to Program, 8/E and 9/EJava How to Program, 9/E and 10/ESimply C++.
5 An App-Driven Tutorial ApproachSimply Visual Basic 2010: An App-Driven Approach, 4/EVisual Basic 2012 How to Program, 6/EVisual C# 2012 How to Program, 5/EVisual C# How to Program, 6/ELiveLessons Video Learning Android 6 App Development Fundamentals, 3/EC++ FundamentalsJava Fundamentals, 2/EC# 6 FundamentalsC# 2012 FundamentalsiOS 8 App Development Fundamentals with Swift , 3/EJavaScript FundamentalsSwift FundamentalsREVEL Interactive MultimediaREVEL for Deitel Java To receive updates on Deitel publications, Resource Centers, training courses, partner offers and more, please join the Deitel communities on Facebook Twitter LinkedIn YouTube Google+ +DeitelFanand register for the free Deitel Buzz Online e-mail newsletter at: To communicate with the authors, send e-mail to: For information on programming-languages corporate training seminars offered by Deitel & Associates, Inc.
6 Worldwide, write to or visit: continuing updates on Pearson/Deitel publications visit: the Deitel Resource Centers, which will help you master programming languages, software develop-ment, Android and iOS app development, and Internet- and web-related topics: Trademarks DEITEL and the double-thumbs-up bug are registered trademarks of Deitel and Associates, and Windows are registered trademarks of the Microsoft Corporation in the and other countries. This book is not sponsored or endorsed by or affiliated with the Microsoft Corporation. UNIX is a registered trademark of The Open this book, trademarks are used. Rather than put a trademark symbol in every occurrence of a trademarked name, we state that we are using the names in an editorial fashion only and to the benefit of the trademark owner, with no intention of infringement of the memory of William Siebert, Professor Emeritus of Electrical Engineering and Computer Science at MIT.
7 Your use of visualization techniques in your Signals and Systems lectures inspired the way generations of engineers, computer scientists, educators and authors present their and Paul DeitelPreface xxiBefore You Begin xxxii1 Introduction Technology: A Brief Review # Programming Programming Programming and Functional Programming International Standard # on Non-Windows Platforms and Web Programming Programming with async and await s.
8 NET Framework Language Runtime Independence Interoperability s Windows Operating System Studio Integrated Development Environment Test-Drive in Visual Studio Community 102 Introduction to Visual Studio and Visual Programming of the Visual Studio Community 2015 IDE to Visual Studio Community 2015 Studio Themes on the Start Page a New Project Project Dialog and Project Templates and Controls Bar and Toolbar the Visual Studio IDE Explorer Window Menu and Context-Sensitive Help Programming: Creating a Simple App that Displays Text and an Image Resources 393 Introduction to C# App Programming App.
9 Displaying a Line of Text Directive Lines and Whitespace Declaration Method a Line of Text Left ({) and Right (}) Braces a Simple App in Visual Studio the Console App the Name of the App File Code and Using IntelliSense and Running the App , Error Messages and the Error List Window Your Simple C# App a Single Line of Text with Multiple Statements Multiple Lines of Text with a Single Statement Interpolation C# App: Adding Integers the int Variable number1 Variables number2 and sum the User for Input a Value into Variable number1 the User for Input and Reading a Value into number2 number1 and number2 the sum with string Interpolation Calculations in Output Statements Expressions in Straight-Line Form for Grouping Subexpressions of Operator Precedence
10 Making: Equality and Relational Operators 65 Contentsix4 Introduction to Classes, Objects, Methods and strings an Account Class an Object Keyword new Class Account s GetName Method a Name from the User Class Account s SetName Method Class with an Instance Variable and Set and Get Methods Class Declaration class and the Class Body Variable name of Type string Method Method Modifiers private and public UML Class Diagram.