When you're programming C# 4.0 and need a little help, this tightly focused and practical book tells you exactly what you need to know -- without long introductions or bloated examples. It's ideal as a succinct quick reference or as a guide to get you rapidly up to speed if you already know Java, C++, or an earlier version of C#.
Written by the authors of the acclaimed C# 4.0 in a Nutshell (O’Reilly), this book covers the entire C# 4.0 language -- without skimping on the details -- including:
C# 4.0 Pocket Reference THIRD EDITION C# 4.0 Pocket Reference Joseph Albahari and Ben Albahari Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo C# 4.0 Pocket Reference, Third Edition by Joseph Albahari and Ben Albahari Copyright © 2010 Joseph Albahari and Ben Albahari. All rights reserved. Printed in Canada. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safari booksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or
[email protected] Editor: Mike Hendrickson Production Editor: Kristen Borg Proofreader: Kiel Van Horn Indexer: Angela Howard Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Robert Romano Printing History: November 2002: February 2008: August 2010: First Edition. Second Edition. Third Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. C# 4.0 Pocket Reference, the image of an African crowned crane, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. ISBN: 978-1-449-39401-1 [TM] 1280502296 Contents C# 4.0 Pocket Reference Using Code Examples How to Contact Us Safari® Books Online A First C# Program Compilation Syntax Identifiers and Keywords Literals, Punctuators, and Operators Comments Type Basics Predefined Type Examples Custom Type Examples Conversions Value Types Versus Reference Types Predefined Type Taxonomy Numeric Types Numeric Literals Numeric Conversions Arithmetic Operators Increment and Decrement Operators Specialized Integral Operations 1 2 2 3 3 6 7 7 9 10 10 10 11 14 15 18 19 20 21 22 22 22 v 8- and 16-Bit Integrals Special Float and Double Values double Versus decimal Real Number Rounding Errors Boolean Type and Operators Equality and Comparison Operators Conditional Operators String