C# 6 for Programmers SIXTH EDITION DEITEL …deitel.com/bookresources/csharpfp6/cover.pdf ·...

2
Android ISBN-13: ISBN-10: 978-0-13-459632-7 0-13-459632-3 9 780134 596327 55499 DEITEL ® DEVELOPER SERIES DEITEL DEITEL DEITEL ® DEVELOPER SERIES SIXTH EDITION SIXTH EDITION for Programmers C# 6 SIXTH EDITION PAUL DEITEL HARVEY DEITEL Use with Windows ® 7, 8 or 10 C# 6 for Programmers for Programmers C# 6 Features: Use with Windows® 7, 8 or 10. Integrated coverage of new C# 6 functionality: string interpolation, expression-bodied methods and properties, auto-implemented property initializers, getter-only properties, nameof, null-conditional operator, exception filters and more. Entertaining and challenging code examples. Deep treatment of classes, objects, inheritance, polymorphism and interfaces. Generics, LINQ and generic collections; PLINQ (Parallel LINQ) for multicore performance. Asynchronous programming with async and await; functional programming with lambdas, delegates and immutability. Files; relational database with LINQ to Entities. Object-oriented design ATM case study with full code implementation. Emphasis on performance and software engineering principles. Visit www.deitel.com Download code examples For Deitel’s programming training courses, www.deitel.com/training or write to [email protected] Join the Deitel social networking communities: Facebook ® at facebook.com/DeitelFan Twitter ® at twitter.com/deitel LinkedIn ® at bit.ly/DeitelLinkedIn YouTube at youtube.com/DeitelTV Google+ at google.com/+DeitelFan Subscribe to the Deitel ® Buzz e-mail newsletter at www.deitel.com/newsletter/ subscribe.html informit.com/ph $54.99 US $68.99 CANADA The professional programmer’s Deitel® guide to C# 6 and object-oriented development for Windows® 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# 6 and .NET in depth. Concepts are presented in the context of 170+ fully coded and tested apps, complete with syntax shading, code highlighting, code walkthroughs, program outputs 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 and more. You’ll enjoy the treatment of object-oriented programming and an object-oriented design/UML® ATM case study, including a complete C# implementation. When you’ve mastered the book, you’ll be ready to start building 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 textbooks, professional books, LiveLessons™ video products, e-books, resource centers and REVEL™ interactive multimedia courses with integrated labs and assessment to master major programming languages and platforms, including C#, C ++ , C, Java™, Android™ app development, iOS app development, Swift™, Visual Basic®, Python™ and Internet and web programming. COMMENTS FROM RECENT EDITIONS REVIEWERS “Takes you from zero to the highest levels of C# programming proficiency, preparing you to tackle the most frequent requirements in modern software development. The code examples really shine. The best presentation of inheritance, interfaces and polymorphism I’ve seen in my 30+ years as a trainer and consultant. I like the early introduction to LINQ and .NET collections, and the coverage of LINQ to Entities for relational databases. Shows the techniques needed to develop real-world apps, including key topics, such as async and await.” Octavio Hernandez, Microsoft Certified Solution Developer (MCSD), Principal Software Engineer at Advanced Bionics “This book’s treatment of LINQ and PLINQ is excellent—I liked how it led naturally to functional programming idioms—skills that will serve professionals best for their future. Also, it was great to see performance testing on multicore systems.” Lucian Wischik, C# Language Design Team, Microsoft “The ultimate book on programming with Microsoft technologies.” Kirill Osenkov, Visual Studio Languages Team, Microsoft “Excellent introduction to the world of .NET for the beginning C# programmer, using the Deitels’ live-code approach and real-world examples.” Bonnie Berent, Microsoft C# MVP “Illustrates the best practices of C# programming. Teaches how to ‘program in the large,’ with material on object- oriented programming and software engineering principles.” Mingsheng Hong, Cornell University “I like the chapter on asynchronous programming with async and await—this is the future of programming, and making these types of tasks ‘easy’ to program is going to be key to any programming language. The introduction to multi-threading was interesting. It was good to see synchronous versus asynchronous programming head-to-head. The flickr web services demo was awesome.”—Bradley Sward, College of Dupage (Continued Inside Back Cover) 9780134596327_Deitel_C#6_Programmers_Mech.indd 1 7/1/16 8:27 AM

Transcript of C# 6 for Programmers SIXTH EDITION DEITEL …deitel.com/bookresources/csharpfp6/cover.pdf ·...

Android

ISBN-13:ISBN-10:

978-0-13-459632-70-13-459632-3

9 7 8 0 1 3 4 5 9 6 3 2 7

5 5 4 9 9

D E I T E L® D E V E L O P E R S E R I E S

D E I T E L D E I T E L

DEITEL® DEVELOPER

SERIES

SIXTH EDITION

S I X T H E D I T I O N

for Programm

ersC# 6

SIXTH EDITION

P A U L D E I T E L • H A R V E Y D E I T E L

Use with Windows® 7, 8 or 10

C# 6for Programmers

for ProgrammersC# 6Features:• Use with Windows® 7, 8 or 10.• Integrated coverage of new C# 6 functionality:

string interpolation, expression-bodied methods and properties, auto-implemented property initializers, getter-only properties, nameof, null-conditional operator, exception filters and more.

• Entertaining and challenging code examples.• Deep treatment of classes, objects, inheritance,

polymorphism and interfaces.• Generics, LINQ and generic collections; PLINQ

(Parallel LINQ) for multicore performance.• Asynchronous programming with async and

await; functional programming with lambdas, delegates and immutability.

• Files; relational database with LINQ to Entities.• Object-oriented design ATM case study with

full code implementation.• Emphasis on performance and software

engineering principles.

Visit www.deitel.com• Download code examples• For Deitel’s programming training

courses, www.deitel.com/training or write to [email protected]

• Join the Deitel social networking communities: Facebook® at facebook.com/DeitelFan Twitter ® at twitter.com/deitel LinkedIn® at bit.ly/DeitelLinkedIn YouTube™ at youtube.com/DeitelTV Google+™ at google.com/+DeitelFan

• Subscribe to the Deitel ® Buzz e-mail newsletter at www.deitel.com/newsletter/ subscribe.html

informit.com/ph

$54.99 US $68.99 CANADA

The professional programmer’s Deitel® guide to C# 6 and object-oriented development for Windows®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# 6 and .NET in depth. Concepts are presented in the context of 170+ fully coded and tested apps, complete with syntax shading, code highlighting, code walkthroughs, program outputs 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 and more. You’ll enjoy the treatment of object-oriented programming and an object-oriented design/UML® ATM case study, including a complete C# implementation. When you’ve mastered the book, you’ll be ready to start building 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 textbooks, professional books, LiveLessons™ video products, e-books, resource centers and REVEL™ interactive multimedia courses with integrated labs and assessment to master major programming languages and platforms, including C#, C++, C, Java™, Android™ app development, iOS app development, Swift™, Visual Basic®, Python™ and Internet and web programming.

COMMENTS FROM RECENT EDITIONS REVIEWERS“Takes you from zero to the highest levels of C# programming proficiency, preparing you to tackle the most frequent requirements in modern software development. The code examples really shine. The best presentation of inheritance, interfaces and polymorphism I’ve seen in my 30+ years as a trainer and consultant. I like the early introduction to LINQ and .NET collections, and the coverage of LINQ to Entities for relational databases. Shows the techniques needed to develop real-world apps, including key topics, such as async and await.”

—Octavio Hernandez, Microsoft Certified Solution Developer (MCSD), Principal Software Engineer at Advanced Bionics

“This book’s treatment of LINQ and PLINQ is excellent—I liked how it led naturally to functional programming idioms—skills that will serve professionals best for their future. Also, it was great to see performance testing on multicore systems.” —Lucian Wischik, C# Language Design Team, Microsoft

“The ultimate book on programming with Microsoft technologies.” —Kirill Osenkov, Visual Studio Languages Team, Microsoft

“Excellent introduction to the world of .NET for the beginning C# programmer, using the Deitels’ live-code approach and real-world examples.” —Bonnie Berent, Microsoft C# MVP

“Illustrates the best practices of C# programming. Teaches how to ‘program in the large,’ with material on object-oriented programming and software engineering principles.” —Mingsheng Hong, Cornell University

“I like the chapter on asynchronous programming with async and await—this is the future of programming, and making these types of tasks ‘easy’ to program is going to be key to any programming language. The introduction to multi-threading was interesting. It was good to see synchronous versus asynchronous programming head-to-head. The flickr web services demo was awesome.”—Bradley Sward, College of Dupage

(Continued Inside Back Cover)

9780134596327_Deitel_C#6_Programmers_Mech.indd 1 7/1/16 8:27 AM

D E I T E L® D E V E L O P E R S E R I E SThe DEITEL® DEVELOPER SERIES is designed for professional programmers. The series presents focused treatments on a growing list of emerging and mature technologies, including C# and .NET, C++, C, JavaScript®, Internet and web development, Android™ app development, Java™, iOS® app development, Swift™ and more. Each book in the series contains the same live-code teaching methodology used in the Deitels’ HOW TO PROGRAM SERIES college textbooks—in this book, most concepts are presented in the context of completely coded, live apps.

A B O U T T H E C O V E R

The cover of this book features a fractal—a geometric figure that can be generated from a pattern repeated recursively. The figure is modified by applying the pattern to each segment of the original figure. Although these figures were studied before the 20th century, it was the mathematician Benoit Mandelbrot who in the 1970s introduced the term fractal, along with the specifics of how a fractal is created and practical applications. Fractal geometry provides mathematical models for many complex forms found in nature, such as mountains, clouds, galaxy clusters and the folds of the brain. Not all fractals resemble objects in nature. Drawing fractals has become a popular art form.

D E I T E L & A S S O C I A T E S , I N C .

Deitel & Associates, Inc., founded by Paul Deitel and Harvey Deitel, is an internationally recognized authoring and corporate training organization, specializing in computer programming languages, object technology, Internet and web software technology, and Android and iOS app development. The company’s clients include many of the world’s largest corporations, government agencies, branches of the military and academic institutions. The company offers instructor-led training courses delivered at client sites worldwide on major programming languages and platforms. Through its 40-year publishing partnership- with Prentice Hall/Pearson, Deitel & Associates, Inc., creates leading-edge programming professional books, college textbooks, video products, e-books and REVEL™ interactive multimedia courses (revel.pearson.com) with integrated labs and assessment. To learn more about Deitel & Associates, Inc., its text and video publications and its worldwide instructor-led, on-site training curriculum, visit www.deitel.com/or send an email to [email protected]. Join the Deitel social media communities on Facebook® (facebook.com/DeitelFan), Twitter® (twitter.com/deitel), Google+™ (google.com/+DeitelFan), LinkedIn® (bit.ly/DeitelLinkedIn) and YouTube™ (youtube.com/DeitelTV), and subscribe to the Deitel® Buzz Online newsletter (www.deitel.com/ newsletter/subscribe.html).

Cover illustration by Lisa Ewing/GettyImages

COMMENTS FROM RECENT EDITIONS REVIEWERS (Continued From Back Cover)

“I really love the way you guys write—it’s interesting and informative!”—Shay Friedman, Microsoft Visual C# MVP

“Good introduction to the most popular GUI controls and working with events. I use the techniques of the strings chapter in the line of business apps that I build. I liked the files and streams chapter and the real-world example. I’m pleased to see the inclusion of additional advanced material online.” —Shawn Weisfeld, Microsoft MVP and President and Founder of UserGroup.tv

“Outstanding presentations of Windows Forms and the .NET I/O facilities. Amazingly clear and intuitive presentation of generics; this chapter represents why I like this book so much—it really shines at presenting advanced topics in a way that can be easily understood. The presentation of LINQ to XML is fabulous.” —Octavio Hernandez, Microsoft Certified Solution Developer (MCSD), Principal Software Engineer at Advanced Bionics

“The beginning of the chapter ‘Classes and Objects: A Deeper Look’ shows a class in an ‘amateur’ state—then you do a great job of describing how many ways one can improve it until it pretty much becomes air-tight in security and functionality. Operator overloading is a good description. Good example of extension methods.” —Bradley Sward, College of Dupage

“Updating an already excellent book with the latest .NET features can only result in a superb product. I like the explanation of properties and the discussion of value vs. reference types. I like your explanation of pass-by-value vs. pass-by-reference. The arrays chapter is one of my favorites. Great job explaining inheritance, polymorphism, interfaces and operator overloading.”

—José Antonio González Seco, Parliament of Andalusia, Spain

“Great job explaining exception handling—with great examples; the new features look pretty sweet. Shows the important things you need to get going with GUI. Delegates are huge and covered well. Interesting description of C# 6’s exception filters.”

—Bradley Sward, College of Dupage

“An excellent introduction to XML, LINQ to XML and related technologies.“ —Helena Kotas, Microsoft

“Good overview of relational databases—it hits on the right LINQ idioms. “—Alex Turner, Microsoft

“Excellent chapter on exceptions. “ —Vinay Ahuja, Architect, Microsoft Corporation

“Great chapter on polymorphism. “ —Eric Lippert, Formerly of Microsoft

“Introduction to LINQ and the List Collection is a great chapter; you do such a good and consistent job of explaining your code. The focus on using LINQ to manage data is cutting edge.”—Stephen Hustedde, South Mountain College

“The presentations are always superbly clear. Excellent intro to Visual Studio and visual programming! I like the early presentation of the new C# 6 string interpolation feature. Introducing UML class diagrams in parallel with the presentation of the language is a great idea. I like the early introduction of exception handling. Brings readers up to speed fast in GUI design and implementation, and event-driven programming. Nice example demonstrating the method call stack and activation records. Database chapter perfectly explains LINQ to Entities and UI binding.”

—Octavio Hernandez, Microsoft Certified Solution Developer (MCSD), Principal Software Engineer at Advanced Bionics

“Chapter 2 is perfect for introducing Visual Studio and GUI elements—I wish I had this chapter when I was first getting back into computers. Everything felt just right in the methods chapter. Recursion will warp anyone’s brain—the stack discussion really helps readers understand what is going on. I really like the deck of cards example, being a former casino gaming programmer. Multidimensional arrays are handled well. I like the attention to detail and the UML. Thank you for showing correct code-formatting conventions. Thorough display of all the ‘pass-by’ types. The card shuffling and dealing simulation is a great example for bringing together many concepts. Good use of overloaded functions for rectangular arrays and jagged arrays. The LINQ chapter is perfect—much more will be revealed in later chapters but readers will remember this. The collections are a nice addition as well—a chapter that is important to get a taste of now so the later material can be feasted upon. Describes inheritance perfectly.” —Bradley Sward, College of Dupage

“This new edition solidifies it as the fundamental tool for learning C# updated to the latest C# 6 features. It covers from the fundamentals of OOP to the most advanced topics, all in an easily accessible way thanks to its crystal-clear explanations. A good job explaining such a complex topic as asynchronous programming.”—José Antonio González Seco, Parliament of Andalusia, Spain

“I liked the natural use of C# 6 string interpolation. A good clear explanation of LINQ query syntax. GUI apps are where coding starts to become fun—you’ve handled it well and covered all the bases. The Game of Craps is an awesome example. I love that you’re paying attention to formats and using them well.”—Lucian Wischik, C# Language Design Team, Microsoft

“An excellent resource to tame the beast that is C#. In the Windows forms chapter, cool how the message box will be customized to the clicked buttons. I love the Paint example. A good look at files and directories—with text mode it’s easier to see what’s going on—binary mode is much more efficient so it’s good to see it here. You show error checking in GUI and files/streams well. File chooser functionality is a nice touch. Good example of serialization. The recursive directory searching is nice.”—Bradley Sward, College of Dupage

9780134596327_Deitel_C#6_Programmers_Mech.indd 2 7/1/16 8:27 AM

pauldeitel
Rectangle
Remove the hyphjen at the end of "partnership"
pauldeitel
Rectangle
LiveLessons video productsand LiveLessons needs a TM