c_charp_8.0_in_a_nutshell.pdf

(12196 KB) Pobierz
C# 8.0
The Definitive Reference
in a Nutshell
Joseph Albahari &
Eric Johannsen
C# 8.0 IN A
NUTSHELL
THE DEFINITIVE REFERENCE
Joseph Albahari and Eric Johannsen
C# 8.0 in a Nutshell
by Joseph Albahari and Eric Johannsen
Copyright © 2020 Joseph Albahari and Eric Johannsen. All rights reserved.
Printed in the United States of America.
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://oreilly.com). For more information, contact
our corporate/institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Acquisitions Editor:
Amanda Quinn
Developmental Editor:
Corbin Collins
Production Editor:
Kate Galloway
Copyeditor:
Octal Publishing, LLC
Proofreader:
Piper Editorial
May 2020:
First Edition
Indexer:
WordCo Indexing Services, Inc.
Interior Designer:
David Futato
Cover Designer:
Karen Montgomery
Illustrator:
Rebecca Demarest
Revision History for the First Edition
2020-04-20:
First Release
See
http://oreilly.com/catalog/errata.csp?isbn=9781492051138
for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
C# 8.0 in a Nutshell,
the
cover image, and related trade dress are trademarks of O’Reilly Media, Inc.
The views expressed in this work are those of the authors and do not represent the publisher’s
views. While the publisher and the authors have used good faith efforts to ensure that the
information and instructions contained in this work are accurate, the publisher and the
authors disclaim all responsibility for errors or omissions, including without limitation
responsibility for damages resulting from the use of or reliance on this work. Use of the infor‐
mation and instructions contained in this work is at your own risk. If any code samples or
other technology this work contains or describes is subject to open source licenses or the
intellectual property rights of others, it is your responsibility to ensure that your use thereof
complies with such licenses and/or rights.
978-1-492-05113-8
[LSCH]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
1. Introducing C# and .NET Core. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Object Orientation
Type Safety
Memory Management
Platform Support
C# and the Common Language Runtime
Frameworks and Base Class Libraries
Legacy and Niche Frameworks
Windows Runtime
A Brief History of C#
A First C# Program
Syntax
Type Basics
Numeric Types
Boolean Type and Operators
Strings and Characters
Arrays
Variables and Parameters
Expressions and Operators
Null Operators
Statements
Namespaces
1
2
3
3
3
4
6
7
8
21
24
27
36
43
45
48
53
64
69
70
81
2. C# Language Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3. Creating Types in C#. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
iii
Zgłoś jeśli naruszono regulamin