C# 7.3 Crashkurs (Nur das E-Book (PDF))
C# 7.3 Crashkurs
Die Syntax der Programmiersprache C# für die Softwareentwicklung in .NET Framework, .NET Core und Xamarin
Über das Buch
Dieses Büchlein ist geeignet für Softwareentwickler, die von einer anderen objektorientierten Programmiersprache (z.B. C++, Java, Visual Basic .NET oder PHP) auf C# umsteigen wollen oder bereits C# einsetzen und ihr Wissen erweitern insbesondere die neusten Sprachfeatures kennenlernen wollen. Wir schulen bei www.IT-Visions.de jedes Jahr hunderte Entwickler auf C# bzw. die neuste Version der Sprache um. Da es viele Umsteiger von Visual Basic .NET zu C# gibt, werden hier die Unterschiede von C# gegenüber Visual Basic .NET an einigen Stellen hervorgehoben.
Für Neueinsteiger, die mit C# erstmals überhaupt eine objektorientiere Programmiersprache erlernen wollen, ist dieses Werk hingegen nicht optimal geeignet, denn es werden die OO-Grundkonzepte nicht erklärt, da die meisten Softwareentwickler heutzutage diese aus anderen Sprachen kennen und das Buch nicht mit diesen Grundlagen unnötig in die Länge gezogen werden soll.
Das Büchlein erhebt nicht den Anspruch, vollständig alle syntaktischen Details zu C# aufzuzeigen, sondern nur die in der Praxis wichtigsten Konstrukte. In diesem Buch werden bewusst alle Syntaxbeispiele anhand von Konsolenanwendungen gezeigt. So brauchen Sie als Leser kein Wissen über eine bestimmte GUI-Bibliothek und die Beispiele sind prägnant fokussiert auf die Syntax.
Pakete
Nur das E-Book (PDF)
Nur das E-Book ohne Programmcodebeispiele
Deutsch
PDF
E-Book (PDF) und Programmcodebeispiele
Dieses Paket enthält neben dem E-Book auch zahlreiche C#-Programmcodebeispiele in Form einer ZIP-Archiv-Datei mit Visual Studio-Projekten für Visual Studio 2017/2019.
Includes:
Programmcodebeispiele zum Buch
ZIP-Datei mit den C#-Programmcodebeispielen zum Buch
Deutsch
PDF
Table of Contents
1 Inhaltsverzeichnis 3
2 Vorwort 8
3 Über den Autor 9
4 Über dieses Büchlein 10
4.1 Versionsgeschichte dieses Büchleins 10
4.2 Geplante Themen 11
4.3 Programmcodebeispiele zu diesem Büchlein 11
5 Fakten zu C# 13
5.1 Der Name C# 13
5.2 Ursprünge von C# 13
5.3 Status der Programmiersprache C# 13
5.4 Versionsgeschichte 15
5.5 Standardisierung 16
5.6 Implementierung des C#-Compilers 17
5.7 Open Source 17
5.8 Kommende Versionen 17
5.9 Parität und Co-Evolution mit Visual Basic .NET 17
6 Grundkonzepte von C# 19
6.1 Sprachtypus 19
6.2 Groß- und Kleinschreibung 19
6.3 Schlüsselwörter der Sprache 19
6.4 Namensregeln und Namenskonventionen 20
6.5 Blockbildung und Umbrüche 20
6.6 Hello World 21
6.7 Eingebaute Funktionen 21
7 Der C#-Compiler 22
7.1 Der ursprüngliche (alte) C#-Compiler 22
7.1.1 Kompilierung mit csc.exe 22
7.1.2 Kommandozeilenparameter 22
7.2 Der aktuelle (neue) C#-Compiler 25
7.2.1 Versionsnummern des Compilers 26
7.2.2 Kommandozeilenparameter 26
8 Erste Schritte Visual Studio 30
8.1 Hello World mit dem .NET Framework 30
8.2 Hello World mit .NET Core 35
8.3 Festlegung der Compilerversion in Visual Studio 39
9 Datentypen 40
9.1 Variablendeklarationen 41
9.2 Typinitialisierung 41
9.3 Literale für Zeichen und Zeichenketten 42
9.4 String Interpolation 43
9.5 Zahlenliterale 43
9.6 Datumsliterale 44
9.7 Lokale Typableitung (Local Variable Type Inference) 44
9.8 Gültigkeit von Variablen 45
9.9 Typprüfungen 45
9.10 Typkonvertierung 46
9.11 Dynamische Typisierung 47
9.12 Pattern Matching 48
9.13 Wertelose Wertetypen (Nullable Value Types) 49
10 Operatoren 53
10.1 Operator ?. 56
10.2 Operator nameof() 56
11 Schleifen 57
11.1 Iterator-Implementierung mit yield (Yield Continuations) 58
11.2 Praxisbeispiel für yield 59
12 Verzweigungen 62
13 Klassendefinition 63
13.1 Klassendefinitionen 63
13.2 Klassenverwendung 64
13.3 Geschachtelte Klassen (eingebettete Klassen) 65
13.4 Sichtbarkeiten/ Zugriffsmodifizierer 65
13.5 Statische Klassen 66
14 Strukturen 67
14.1 Wertetyp versus Referenztyp 67
14.2 Deklaration von Strukturen 69
14.3 Verwendung von Strukturen 70
15 Attribute (Fields und Properties) 72
15.1 Abweichungen von der Informatik 72
15.2 Felder (Field-Attribute) 73
15.3 Eigenschaften (Property-Attribute) 74
15.3.1 Explizite Properties 74
15.3.2 Automatische Properties 75
15.3.3 Zusammenfassung zu Properties 76
16 Methoden 78
16.1 Methodendefinition und Rückgabewerte 78
16.2 Methodenparameter 78
16.3 Optionale und benannte Parameter 79
16.4 Ref und out 80
16.5 Statische Methode als globale Funktionen 81
16.6 Lokale Funktion (ab C# 7.0) 82
16.7 Caller-Info-Annotationen 82
17 Konstruktoren und Destruktoren 85
18 Aufzählungstypen (Enumeration) 88
19 Expression-bodied Members 89
20 Objektinitialisierung 90
21 Behandlung von null 91
22 Partielle Klassen 94
23 Partielle Methoden 95
24 Erweiterungsmethoden (Extension Methods) 96
25 Annotationen (.NET-Attribute) 98
26 Generische Klassen 101
26.1 Definition einer generischen Klasse 101
26.2 Verwendung einer generischen Klasse 101
26.3 Einschränkungen für generische Typparameter (Generic Constraints) 102
26.4 Kovarianz für Typparameter 102
27 Objektmengen 106
27.1 Einfache Arrays 106
27.2 Objektmengen (untypisiert und typisiert) 106
28 Anonyme Typen 108
29 Tupel 109
29.1 Alte Tupelimplementierung mit System.Collections.Tupel 109
29.2 Neue Tupelimplementierung in der Sprachsyntax 109
29.3 Dekonstruktion 110
29.4 Serialisierung von Tupeln 112
29.5 Vergleich von Tupeln (C# 7.3) 112
30 Implementierungsvererbung 113
31 Schnittstellen (Interfaces) 115
32 Namensräume (Namespaces) 116
32.1 Softwarekomponenten versus Namensräume 116
32.2 Vergabe der Namensraumbezeichner 117
32.3 Vergabe der Typnamen 118
32.4 Namensräume deklarieren 118
32.5 Import von Namensräumen 119
32.6 Verweis auf Wurzelnamensräume 119
32.6.1 Beispiel 119
33 Operatorüberladung 121
34 Funktionale Programmierung in C# (Delegates / Lambdas) 122
34.1 Delegates 122
34.2 Vordefinierte Delegates Action<T> und Func<T> 124
34.3 Prädikate mit Predicate<T> 125
34.4 Lambda-Ausdrücke 126
35 Ereignisse 130
35.1 Definition von Ereignissen 130
35.2 Ereignis auslösen 130
35.3 Ereignisbehandlung 131
36 Laufzeitfehler 132
36.1 Fehler abfangen 132
36.2 Fehler auslösen 133
36.3 Eigene Fehlerklassen 134
37 Kommentare und XML-Dokumentation 135
38 Asynchrone Ausführung mit async und await 137
38.1 Async und await mit der .NET-Klassenbibliothek 137
38.2 Async und await mit eigenen Threads 138
38.3 Weitere Möglichkeiten 139
39 Zeigerprogrammierung 140
39.1 Zeigerprogrammierung mit unsafe 140
39.2 Zeigerprogrammierung mit ref (Managed Pointer) 142
40 Abfrageausdrücke / Language Integrated Query (LINQ) 145
40.1 Einführung und Motivation 145
40.2 LINQ-Provider 146
40.2.1 LINQ-Provider von Microsoft im .NET Framework 146
Andere LINQ-Provider 146
40.2.2 Formen von LINQ 146
40.2.3 Einführung in die LINQ-Syntax 147
Übersicht über die LINQ-Befehle 151
40.3 LINQ to Objects 158
40.3.1 LINQ to Objects mit elementaren Datentypen 158
40.3.2 LINQ to Objects mit komplexen Typen des .NET Framework 162
40.3.3 LINQ to Objects mit eigenen Geschäftsobjekten 165
40.4 Parallel LINQ (PLINQ) 170
41 Syntaxreferenz: C# versus Visual Basic .NET 173
42 Ausblick auf C# 8.0 179
42.1 Nullable Reference Types (C# 8.0) 179
42.1.1 C# 7.3 erkennt die Programmierfehler nicht 179
42.1.2 C# 8.0 ist strenger 180
42.1.3 Einstellen der Compiler-Version 181
42.2 Ranges (C# 8.0) 182
43 Quellen im Internet 183
44 Stichwortverzeichnis (Index) 184
Andere Bücher dieses Autors
Authors have earned$9,886,269writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.
Erfahren Sie mehr über das Schreiben mit Leanpub
Die bedingungslose Leanpub, Kein Risiko, 100% zufrieden Garantie
Innerhalb von 45 Tagen ab Kauf kannst du dein Geld zu 100% zurückverlangen, bei jedem Leanpub-Kauf, in nur zwei Klicks. Wir bearbeiten die Erstattungen manuell, daher dauert es ein paar Tage, bis der Betrag ankommt.
Lese die kompletten Bedingungen.
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Top Books
C++ Best Practices
Jason TurnerLevel up your C++, get the tools working for you, eliminate common problems, and move on to more exciting things!
OpenIntro Statistics
David Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntroA complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
Functional Design and Architecture
Alexander GraninSoftware Design in Functional Programming, Design Patterns and Practices, Methodologies and Application Architectures. How to build real software in Haskell with less efforts and low risks. The first complete source of knowledge.
R Programming for Data Science
Roger D. PengThis book brings the fundamentals of R programming to you, using the same material developed as part of the industry-leading Johns Hopkins Data Science Specialization. The skills taught in this book will lay the foundation for you to begin your journey learning data science. Printed copies of this book are available through Lulu.
C++20
Rainer GrimmC++20 is the next big C++ standard after C++11. As C++11 did it, C++20 changes the way we program modern C++. This change is, in particular, due to the big four of C++20: ranges, coroutines, concepts, and modules.
I am a Software Engineer and I am in Charge
Alexis Monville and Michael DoyleI am a Software Engineer and I am in Charge is a real-world, practical book that helps you increase your impact and satisfaction at work no matter who you work with.
In the book, we will follow Sandrine, a fictional character who learns to think in a new way enabling her to take a different course of action.
Atomic Kotlin
Bruce Eckel and Svetlana IsakovaFor both beginning and experienced programmers! From the author of the multi-award-winning Thinking in C++ and Thinking in Java together with a member of the Kotlin language team comes a book that breaks the concepts into small, easy-to-digest "atoms," along with exercises supported by hints and solutions directly inside IntelliJ IDEA!
Invest In Digital Health - The Medical Futurist's Guide
Dr. Bertalan MeskoArtificial Intelligence and Digital Health are booming. In this book, we explain why now it's a good time to invest in Digital Health and give recommendations on where to invest by looking at the top 24 technological trends we find the most promising.
The Hundred-Page Machine Learning Book
Andriy BurkovEverything you really need to know in Machine Learning in a hundred pages.
Mastering STM32
Carmine NovielloWith more than 600 microcontrollers, STM32 is probably the most complete ARM Cortex-M platform on the market. This book aims to be the first guide around that introduces the reader to this exciting MCU portfolio from ST Microelectronics and its official CubeHAL.
Top Bundles
- #1
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
2 Books
"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before... - #2
CCIE Service Provider Ultimate Study Bundle
2 Books
Piotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification... - #3
The Future of Digital Health
6 Books
We put together the most popular books from The Medical Futurist to provide a clear picture about the major trends shaping the future of medicine and healthcare. Digital health technologies, artificial intelligence, the future of 20 medical specialties, big pharma, data privacy and how technology giants such as Amazon or Google want to conquer... - #4
Cisco CCNA 200-301 Complet
4 Books
Ce lot comprend les quatre volumes du guide préparation à l'examen de certification Cisco CCNA 200-301. - #5
CCDE Practical Studies (All labs)
3 Books
CCDE lab - #6
"The C++ Standard Library" and "Concurrency with Modern C++"
2 Books
Get my books "The C++ Standard Library" and "Concurrency with Modern C++" in a bundle. The first book gives you the details you should know about the C++ standard library; the second one dives deeper into concurrency with modern C++. In sum, you get more than 600 pages full of modern C++ and about 250 source files presenting the standard library... - #7
Modern Management Made Easy
3 Books
Read all three Modern Management Made Easy books. Learn to manage yourself, lead and serve others, and lead the organization. - #8
Linux Administration Complet
4 Books
Ce lot comprend les quatre volumes du Guide Linux Administration :Linux Administration, Volume 1, Administration fondamentale : Guide pratique de préparation aux examens de certification LPIC 1, Linux Essentials, RHCSA et LFCS. Administration fondamentale. Introduction à Linux. Le Shell. Traitement du texte. Arborescence de fichiers. Sécurité... - #9
Programming with Ease
3 Books
Alle drei Bände der Serie Programming with Ease in einem Paket. Darin findest du alles, was ich dir zu den wichtigsten Phasen der Softwareentwicklung im Hinblick auf Clean Code Development für langfristig hohe Produktivität sagen kann.Im Band Slicing findest du die Anforderungsanalyse im Rahmen eines iterativ-inkrementellen Vorgehensmodells aus... - #10
Vagrant Ansible
2 Books
Unveil the power of Ansible and Vagrant with this bundle at a special price. You'll have everything you need to get started with Vagrant - learn the basics and how to create your virtual development environments, using Ansible as provisioner! About Vagrant Cookbook Vagrant Cookbook is a complete guide to get started with Vagrant and create your...