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.
Do Well. Do Good.
Authors have earned$11,841,865writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.
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
The Hitchhiker's Guide to DFIR: Experiences From Beginners and Experts
Barry Grundy, Tristram, John Haynes, ApexPredator, Andrew Rathbun, Kevin Pagano, Victor Heiland, Nisarg Suthar, Guus Beckers, and Jason WilkinsA first of its kind crowdsourced DFIR book written on GitHub by the members of the Digital Forensics Discord Server to share knowledge!
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.
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.
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.
Maîtriser Apache JMeter
Philippe Mouawad, Bruno Demion (Milamber), and Antonio Gomes RodriguesToute la puissance d'Apache JMeter expliquée par ses commiteurs et utilisateurs experts. De l'intégration continue en passant par le Cloud, vous découvrirez comment intégrer JMeter à vos processus "Agile" et Devops.
If you're looking for the newer english version of this book, go to Master JMeter : From load testing to DevOps
Software Architecture for Developers
Simon BrownA developer-friendly, practical and pragmatic guide to lightweight software architecture, technical leadership and the balance with agility.
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!
Thinking with Types
Sandy MaguireThis book aims to be the comprehensive manual for type-level programming. It's about getting you from here to there---from a competent Haskell programmer to one who convinces the compiler to do their work for them.
Biological Modeling
Phillip CompeauIn this ebook, learn why zebras have stripes, why SARS-CoV-2 spread so quickly around the planet, how to train a computer to classify cellular images, and more!
Introduction to Data Science
Rafael A IrizarryThe demand for skilled data science practitioners in industry, academia, and government is rapidly growing. This book introduces concepts from probability, statistical inference, linear regression and machine learning and R programming skills. Throughout the book we demonstrate how these can help you tackle real-world data analysis challenges.
Top Bundles
- #1
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... - #2
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!? - #3
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... - #4
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... - #5
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... - #6
All the Books of The Medical Futurist
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, digital health investments and how technology giants such as Amazon... - #8
Learn Git, Bash, and Terraform the Hard Way
3 Books
Learn Git, Bash and Terraform using the Hard Way method.These technologies are essential tools in the DevOps armoury. These books walk you through their features and subtleties in a simple, gradual way that reinforces learning rather than baffling you with theory. - #9
Static Analysis and Automated Refactoring
2 Books
As PHP developers we are living in the "Age of Static Analysis". We can use a tool like PHPStan to learn about potential bugs before we ship our code to production, and we can enforce our team's programming standards using custom PHPStan rules. Recipes for Decoupling by Matthias Noback teaches you in great detail how to do this, while also...