C# 6.0 and the .NET 4.6 Framework

C# 6.0 and the .NET 4.6 Framework

C# 6.0 and the .NET 4.6 Framework Seventh Edition Andrew Troelsen Philip Japikse C# 6.0 and the .NET 4.6 Framework Copyright © 2015 by Andrew Troelsen and Philip Japikse This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher's location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under the respective Copyright Law. ISBN-13 (pbk): 978-1-4842-1333-9 ISBN-13 (electronic): 978-1-4842-1332-2 Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director: Welmoed Spahr Lead Editor: James DeWolf Technical Reviewer: Andy Olsen Development Editor: Douglas Pundick Editorial Board: Steve Anglin, Mark Beckner, Gary Cornell, Louise Corrigan, Jim DeWolf, Jonathan Gennick, Robert Hutchinson, Michelle Lowman, James Markham, Susan McDermott, Matthew Moodie, Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Gwenan Spearing, Matt Wade, Steve Weiss Coordinating Editor: Melissa Maldonado Copy Editors: Mary Behr, Kim Wimpsett Compositor: SPi Global Indexer: SPi Global Artist: SPi Global Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springer.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. For information on translations, please e-mail [email protected], or visit www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this text is available to readers at www.apress.com. For detailed information about how to locate your book’s source code, go to www.apress.com/source-code/. To the entire Troelsen clan: Mary (mom), Walter (dad), Mandy (wife), and Soren (son). We miss you, Mikko (the cat). —Andrew To my family, Amy (wife), Conner (son), Logan (son), and Skylar (daughter), thank you for all of the support and patience you have given me. —Philip Contents at a Glance About the Authors ��������������������������������������������������������������������������������������������������� lix About the Technical Reviewer �������������������������������������������������������������������������������� lxi Acknowledgments ������������������������������������������������������������������������������������������������ lxiii Introduction ������������������������������������������������������������������������������������������������������������lxv ■ Part I: Introducing C# and the �NET Platform ������������������������������������� 1 ■ Chapter 1: The Philosophy of �NET ������������������������������������������������������������������������� 3 ■ Chapter 2: Building C# Applications �������������������������������������������������������������������� 35 ■ Part II: Core C# Programming ����������������������������������������������������������� 59 ■ Chapter 3: Core C# Programming Constructs, Part I ������������������������������������������� 61 ■ Chapter 4: Core C# Programming Constructs, Part II ���������������������������������������� 109 ■ Part III: Object-Oriented Programming with C# ������������������������������ 149 ■ Chapter 5: Understanding Encapsulation ���������������������������������������������������������� 151 ■ Chapter 6: Understanding Inheritance and Polymorphism �������������������������������� 205 ■ Chapter 7: Understanding Structured Exception Handling �������������������������������� 247 ■ Chapter 8: Working with Interfaces ������������������������������������������������������������������ 275 ■ Part IV: Advanced C# Programming ����������������������������������������������� 313 ■ Chapter 9: Collections and Generics ������������������������������������������������������������������ 315 ■ Chapter 10: Delegates, Events, and Lambda Expressions ��������������������������������� 355 v ■ CONTENTS AT A GLANCE ■ Chapter 11: Advanced C# Language Features ��������������������������������������������������� 399 ■ Chapter 12: LINQ to Objects ������������������������������������������������������������������������������� 439 ■ Chapter 13: Understanding Object Lifetime ������������������������������������������������������� 473 ■ Part V: Programming with �NET Assemblies ����������������������������������� 501 ■ Chapter 14: Building and Configuring Class Libraries ��������������������������������������� 503 ■ Chapter 15: Type Reflection, Late Binding, and Attribute-Based Programming ����� 555 ■ Chapter 16: Dynamic Types and the Dynamic Language Runtime �������������������� 599 ■ Chapter 17: Processes, AppDomains, and Object Contexts ������������������������������� 623 ■ Chapter 18: Understanding CIL and the Role of Dynamic Assemblies ��������������� 651 ■ Part VI: Introducing the �NET Base Class Libraries ������������������������� 693 ■ Chapter 19: Multithreaded, Parallel, and Async Programming ������������������������� 695 ■ Chapter 20: File I/O and Object Serialization����������������������������������������������������� 749 ■ Chapter 21: ADO�NET Part I: The Connected Layer ��������������������������������������������� 799 ■ Chapter 22: ADO�NET Part II: The Disconnected Layer ��������������������������������������� 859 ■ Chapter 23: ADO�NET Part III: Entity Framework ����������������������������������������������� 929 ■ Chapter 24: Introducing LINQ to XML �������������������������������������������������������������� 1001 ■ Chapter 25: Introducing Windows Communication Foundation ���������������������� 1021 ■ Part VII: Windows Presentation Foundation ��������������������������������� 1083 ■ Chapter 26: Introducing Windows Presentation Foundation and XAML ���������� 1085 ■ Chapter 27: Programming with WPF Controls ������������������������������������������������� 1147 ■ Chapter 28: WPF Graphics Rendering Services ����������������������������������������������� 1229 ■ Chapter 29: WPF Resources, Animations, Styles, and Templates �������������������� 1277 ■ Chapter 30: Notifications, Commands, Validation, and MVVM ������������������������ 1329 vi ■ CONTENTS AT A GLANCE ■ Part VIII: ASP�NET �������������������������������������������������������������������������� 1383 ■ Chapter 31: Introducing ASP�NET Web Forms �������������������������������������������������� 1385 ■ Chapter 32: ASP�NET Web Controls, Master Pages, and Themes ��������������������� 1435 ■ Chapter 33: ASP�NET State Management Techniques �������������������������������������� 1491 ■ Chapter 34: ASP�NET MVC and Web API ����������������������������������������������������������� 1527 ■ Appendix A: Programming with Windows Forms �������������������������������������������� 1603 ■ Appendix B: Platform-Independent �NET Development with Mono ������������������ 1651 Index ������������������������������������������������������������������������������������������������������������������� 1673 vii Contents About the Authors ��������������������������������������������������������������������������������������������������� lix About the Technical Reviewer �������������������������������������������������������������������������������� lxi Acknowledgments ������������������������������������������������������������������������������������������������ lxiii Introduction ������������������������������������������������������������������������������������������������������������lxv ■ Part I: Introducing C# and the �NET Platform ������������������������������������� 1 ■ Chapter 1: The Philosophy of �NET �������������������������������������������������������������������������

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    75 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us