Cover
Title Page
Copyright Page
Dedication Page
About the Author
About the Reviewer
Acknowledgement
Preface
Table of Contents
1. C# Fundamentals
Introduction
Structure
Objectives
Tools and Environment Setup
Installing Visual Studio 2022
Installing Visual Studio Code
Introduction to Visual Studio 2022
Introduction to Visual Studio Code
History of .NET
.NET Core Versions
.NET 5, .NET 6 and .NET 7
Introduction to C# Language
Loops, Operators, and Iterators
While statement
Do-while statement
For loop
Foreach statement
Operators
Assignment operator
Error Handling
Namespaces
New features in C# 10 and 11
Global using directives
Generic Attributes
List patterns
Raw string Literals
New Debugger Features in Visual Studio
Temporary Breakpoints
Breakpoint hover glyph
Conclusion
Points to remember
Multiple Choice Questions
Answers
Questions
Key terms
2. .NET Fundamentals
Introduction
Structure
Objectives
Multi-platform concepts
.NET for cloud development
Azure Storage Accounts
Azure Functions
New features in .NET 6
Hot reload
.NET MAUI
HTTP/3
Custom platform checks
Conclusion
Points to remember
Multiple choice questions
Answers
Questions
Key terms
3. Basic Concepts of Object-Oriented Programming in C#
Introduction
Structure
Objectives
Classes and access modifiers
Encapsulation
Inheritance
Reusability
Polymorphism
Partial class
Constructor
Static classes
Structs
Interfaces
Conclusion
Points to Remember
Multiple choice questions
Answer
Questions
Key terms
4. SOLID Principles in C#
Introduction
Structure
Objectives
The Single Responsibility Principle
The open-closed principle
The Liskov substitution principle
The interface segregation principle
The dependency inversion principle
Conclusion
Points to remember
Multiple choice questions
Answers
Questions
Key terms
5. Introduction to Design Patterns
Introduction
Structure
Objectives
Importance of design patterns
History of Design Patterns
Design Pattern categories
Creational patterns
Behavioral patterns
Structural patterns
Patterns for Distributed Systems
Microservices design patterns
Conclusion
Points to remember
Multiple choice questions
Answers
Questions
Key terms
6. Singleton Pattern in .NET Applications
Introduction
Structure
Objectives
Single pattern definition
Single attern definition
Multiple instances
Modifications for the single pattern
Thread-safe implementation
Dependency injection
Conclusion
Points to remember
Multiple choice questions
Answer
Questions
Key terms
7. Abstract Factory Pattern with Blazor
Introduction
Structure
Objectives
Abstract Factory definition
Abstract Factory scenario
Abstract Factory implementation
Conclusion
Points to remember
Multiple choice questions
Answer
Questions
Key terms
8. Prototype Pattern with ASP.NET Razor
Introduction
Structure
Objectives
Prototype pattern definition
Prototype pattern implementation
Conclusion
Points to remember
Multiple choice questions
Answer
Questions
Key terms
9. Factory Method Pattern Using New Features on C# 11
Introduction
Structure
Objectives
Factory Method definition
Factory Method implementation
New features in C# 11
Required fields
UTF-8 string literals
Newlines in string interpolations
List patterns
Raw string literals
Conclusion
Points to remember
Multiple choice questions
Answer
Questions
Key terms
10. Adapter Pattern with Entity Framework Core
Introduction
Structure
Objectives
Adapter pattern definition
Adapter pattern implementation
Conclusion
Points to remember
Multiple choice questions
Answers
Questions
Key terms
11. Composite Pattern with ASP.NET MVC
Introduction
Structure
Objectives
Composite pattern definition
Composite pattern implementation
Conclusion
Points to remember
Multiple choice questions
Answer
Questions
Key terms
12. Proxy Pattern with GRPC
Introduction
Structure
Objectives
Proxy pattern definition
Proxy pattern types
Proxy pattern structure
Common use in real projects
Proxy pattern implementation
Scenario requirements
Practical example
GRPC with Blazor
Conclusion
Points to remember
Multiple choice questions
Answers
Questions
Key terms
13. Command Pattern Using MediatR
Introduction
Structure
Objectives
Command pattern definition
Proxy pattern implementation
Extra classes
MediatR and Command Pattern
Conclusion
Points to remember
Multiple choice questions
Answers
Questions
Key terms
14. Strategy Pattern Using Azure C# and Azure Functions
Introduction
Structure
Objectives
Strategy pattern definition
Estrategy pattern structure
Strategy pattern implementation
Creating the city strategy class
Strategy pattern and Azure Functions
Conclusion
Points to remember
Multiple choice questions
Answers
Questions
Key terms
15. Observer Pattern
Introduction
Structure
Objectives
Observer pattern definition
Observer pattern implementation
Creating the User class
Creating the Blog Post class
Client application
Conclusion
Points to remember
Multiple choice questions
Answers
Questions
Key terms
Index
This book is a complete guide to design patterns and object-oriented programming (OOP) in C# and .NET. It covers everything from the basics of C# and Visual Studio to advanced topics like software architecture and best coding practices, including the SOLID principles.
The book starts with the basics of C#, .NET, the SOLID principles, and the OOP paradigm. Then, it introduces widely-used design patterns with hands-on examples in C# and .NET. These examples include real-world scenarios and step-by-step instructions. In addition, the book provides an overview of advanced features in the .NET ecosystem, insights into current market solutions for software strategy, and guidance on when to use a design pattern-centric approach. The book concludes with valuable recommendations and best practices for .NET applications, especially when using design patterns.
Learn how to use the Singleton pattern to ensure that only one instance of a class exists in your application.
Learn how to use the Prototype pattern to create new objects by copying existing objects.
Learn how to use the Factory Method pattern to create objects without specifying their concrete classes.
Learn how to use the Adapter pattern to make incompatible interfaces work together.
Learn how to use the Proxy pattern to control access to objects.
Learn how to use the Strategy pattern to encapsulate algorithms.
This book is invaluable for software developers switching to .NET, experienced .NET developers learning about advanced design patterns, object-oriented programming paradigms, and SOLID principles, and .NET Core enthusiasts looking for information on core functionalities and recent platform advancements.