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
PDF
Deutsch
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
PDF
Deutsch
Inhaltsverzeichnis
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
Die bedingungslose Leanpub, Kein Risiko, 100% zufrieden Garantie
Innerhalb von 60 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.
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earned$12,046,757writing, publishing and selling on Leanpub.
Learn more about writing on Leanpub
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, tablets, and 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
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.
Talking with Tech Leads
Patrick KuaA book for Tech Leads, from Tech Leads. Discover how more than 35 Tech Leads find the delicate balance between the technical and non-technical worlds. Discover the challenges a Tech Lead faces and how to overcome them. You may be surprised by the lessons they have to share.The Rails 7 Way
Obie Fernandez, Lucas Dohmen, and Tom Henrik AadlandThe Rails™ 7 Way is the comprehensive, authoritative reference guide for professionals delivering production-quality code using modern Ruby on Rails. It illuminates the entire Rails 7 API, its most powerful idioms, design approaches, and libraries. Building on the previous editions, this edition has been heavily refactored and updated.
Mastering STM32 - Second Edition
Carmine NovielloWith more than 1200 microcontrollers, STM32 is probably the most complete ARM Cortex-M platform on the market. This book aims to be the most complete guide around introducing the reader to this exciting MCU portfolio from ST Microelectronics and its official CubeHAL and STM32CubeIDE development environment.
JavaScript for hackers
Gareth HeyesLearn how to find interesting behaviour and flaws in JavaScript. Reading this book you will find the latest and greatest techniques for hacking JavaScript and generating XSS payloads. Includes ways to construct JavaScript using only +[]()! characters. Never heard of DOM Clobbering? This book has all the details.
Functional Event-Driven Architecture
Gabriel VolpeExplore the event-driven architecture (EDA) in a purely functional way. Learn to design and develop distributed systems that scale. Identify common design patterns in such systems.
Take your functional programming skills to the next level by joining me in developing a distributed system powered by Apache Pulsar and Fs2 streams, all in Scala 3!
Build Your Own Redis with C/C++
build-your-own.org- Why build Redis? Two topics to learn: network programming and data structures.
- Why from scratch? A quote from Richard Feynman: "What I cannot create, I do not understand".
- Why C? C is widely used for system programming and infrastructure software.
- Why a book? The real Redis is complex, this book breaks down the essense into easy-to-digest steps.
Machine Learning Q and AI
Sebastian Raschka, PhDHave you recently completed a machine learning or deep learning course and wondered what to learn next? With 30 questions and answers on key concepts in machine learning and AI, this book provides bite-sized bits of knowledge for your journey to becoming a machine learning expert.
Implementing DDD, CQRS and Event Sourcing
Alex LawrenceLearn how to implement DDD, CQRS and Event Sourcing. Understand the theory and put it into practice with JavaScript and Node.js. Utilize an extensive source code bundle and an interactive execution feature for a hands-on experience.
Ansible for DevOps
Jeff GeerlingAnsible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
Top Bundles
- #1
Software Architecture
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
Modern C++ Collection
3 Books
Get All about Modern C++C++ Standard Library, including C++20Concurrency with Modern C++, including C++20C++20Each book has about 200 complete code examples. Updates are included. When I update one of the books, you immediately get the updated bundle. You can expect significant updates to each new C++ standard (C++23, C++26, .. ) and also... - #4
Pattern-Oriented Memory Forensics and Malware Detection
2 Books
This training bundle for security engineers and researchers, malware and memory forensics analysts includes two accelerated training courses for Windows memory dump analysis using WinDbg. It is also useful for technical support and escalation engineers who analyze memory dumps from complex software environments and need to check for possible... - #5
1500 QUIZ COMMENTATI (3 libri)
3 Books
Tre libri dei QUIZ MMG Commentati al prezzo di DUE! I QUIZ dei concorsi ufficiali di Medicina Generale relativi agli anni: 2000-2001-2003-2012-2013-2014-2015-2016-2017-2018-2019-2020-2021 +100 inediti Raccolti in unico bundle per aiutarvi nello studio e nella preparazione al concorso. All'interno di ogni libro i quiz sono stati suddivisi per... - #6
Practical FP in Scala + Functional event-driven architecture
2 Books
Practical FP in Scala (A hands-on approach) & Functional event-driven architecture, aka FEDA, (Powered by Scala 3), together as a bundle! The content of PFP in Scala is a requirement to understand FEDA so why not take advantage of this bundle!? - #9
Growing Agile: The Complete Coach's Guide
7 Books
Growing Agile: Coach's Guide Series This bundle provides a collection of training and workshop plans for a variety of agile topics. The series is aimed at agile coaches, trainers and ScrumMasters who often find themselves needing to help teams understand agile concepts. Each book in the series provides the plans, slides, handouts and activity... - #10
Mastering Containers
2 Books
Docker and Kubernetes are taking the world by storm! These books will get you up-to-speed fast! Docker Deep Dive is over 400 pages long, and covers all objectives on the Docker Certified Associate exam.The Kubernetes Book includes everything you need to get up and running with Kubernetes!