ebook img

C# in Depth PDF

586 Pages·2·6.541 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview C# in Depth

Covers C# 4 IN DEPTH SECOND EDITION Jon Skeet FOREWORD BY ERIC LIPPERT M A N N I N G Praise for the First Edition The best C# book available for intermediate to expert developers. Experienced .NET developers who think they know everything there is to know about the C# language will almost certainly learn more than a thing or two in this book. It is an interesting cover- to-cover read, and will be a handy desktop reference as well. I recommend this book to anyone who wants to become a C# expert. —Alvin Ashcraft, DZone review Simply put, C# in Depth is perhaps the best computer book I’ve read. —Craig Pelkie, Author, System iNetwork I have been developing in C# from the very beginning and this book had some nice sur- prises even for me. I was especially impressed with the excellent coverage of delegates, anonymous methods, covariance and contravariance. Even if you are a seasoned devel- oper, C# in Depth will teach you something new about the C# language... This book truly has depth that no other C# language book can touch. —Adam J. Wolf Southeast Valley .NET User Group I enjoyed reading the whole book; it is well-written—the samples are easy to understand. I actually found it very easy to engage into the whole lambda expressions topic and really liked the chapter about lambda expressions. —Jose Rolando Guay Paz Web Developer, CSW Solutions This book wraps up the author’s great knowledge of the inner workings of C# and hands it over to readers in a well-written, concise, usable book. —Jim Holmes Author of Windows Developer Power Tools Every term is used appropriately and in the right context, every example is spot-on and contains the least amount of code that shows the full extent of the feature...this is a rare treat. —Franck Jeannin, Amazon UK reviewer If you have developed using C# for several years now, and would like to know the inter- nals, this book is absolutely right for you. —Golo Roden, Author, Speaker, and Trainer for .NET and related technologies More Praise for the First Edition If there’s one must-have book for .NET developers, this is it. Jon Skeet provides every- thing you need to know about C# mazes, with particular attention to LINQ. The author really knows his stuff and provides invaluable comments about C# features. —Luigi Zambetti, Developer, Milan This book is the best C# reference money can buy at the moment. —Jan Van Ryswyck, ElegantCode.com Jon Skeet’s writing style is clear and concise and he’s got lots of great examples. —Peter Kellner, Blogger A first-class book about C#. —Teemu Keiski, ASP.NET MVP, AspInsider Become a C# 3 maestro! —Fabrice Marguerie, C# MVP, author of LINQ in Action The best C# book I’ve ever read. —Chris Mullins, C# MVP Clear and concise. —Robin Shahan, GoldMail.com A treat! —Anil Radhakrishna, ASP.NET MVP Reveals C#’s powerful mysteries. —Christopher Haupt, BuildingWebApps.com So good, it hurts my head. —J.D. Conley, Hive7 Inc. Enriches the beginner, polishes the expert. —Josh Cronemeyer ThoughtWorks C# in Depth SECOND EDITION JON SKEET MANNING Greenwich (74° w. long.) For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 180 Broad St. Suite 1323 Stamford, CT 06901 Email: [email protected] ©2011 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine. Manning Publications Co. Development editor: Jeff Bleiel 180 Broad St. Copyeditor: Benjamin Berg Suite 1323 Proofreader: Katie Tennant Stamford, CT 06901 Typesetter: Dottie Marsico Cover designer: Marija Tudor ISBN 978-1-935182-47-4 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – MAL – 15 14 13 12 11 10 For Holly, with much, much love brief contents PART 1 PREPARING FOR THE JOURNEY.......................................1 1 ■ The changing face of C# development 3 2 ■ Core foundations: building on C# 1 27 PART 2 C# 2: SOLVING THE ISSUES OF C# 1 ............................ 55 3 ■ Parameterized typing with generics 57 4 ■ Saying nothing with nullable types 103 5 ■ Fast-tracked delegates 130 6 ■ Implementing iterators the easy way 156 7 ■ Concluding C# 2: the final features 179 PART 3 C# 3: REVOLUTIONIZING HOW WE CODE.................... 201 8 ■ Cutting fluff with a smart compiler 203 9 ■ Lambda expressions and expression trees 227 10 ■ Extension methods 256 11 ■ Query expressions and LINQ to Objects 279 12 ■ LINQ beyond collections 321 vii viii PART 4 C# 4: PLAYING NICELY WITH OTHERS......................... 363 13 ■ Minor changes to simplify code 365 14 ■ Dynamic binding in a static language 401 15 ■ Letting your code speak more clearly with Code Contracts 452 16 ■ Whither now? 490 contents foreword xix preface xxi acknowledgments xxiii about this book xxv PART 1 PREPARING FOR THE JOURNEY ..............................1 1 The changing face of C# development 3 1.1 Starting with a simple data type 4 The Product type in C# 1 4 ■ Strongly typed collections in C# 2 6 ■ Automatically implemented properties in C# 3 7 Named arguments in C# 4 7 1.2 Sorting and filtering 9 Sorting products by name 9 ■ Querying collections 12 1.3 Handling an absence of data 14 Representing an unknown price 14 ■ Optional parameters and default values 15 1.4 Introducing LINQ 16 Query expressions and in-process queries 16 ■ Querying XML 17 ■ LINQ to SQL 18 ix

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.