This project is a simple example of the use of some design patterns in C#.
The path to the Singleton pattern is here
The Singleton pattern is a creational pattern that ensures a class has only one instance and provides a global point of access to that instance. It is useful when exactly one object is needed to coordinate actions across the system.
I used the Lazy<T> class to ensure that the instance is created only when it is needed.
- The Singleton pattern is used to store an array of
Vehicles
The path to the Builder pattern files is here
The Builder pattern is a creational pattern that allows constructing complex objects step by step. The pattern allows you to produce different types and representations of an object using the same construction code.
- The Builder pattern is used to create some types of
Vehiclessuch asMustag, Explorer, etcobjects.
The path to the Factory Method pattern files is here
The Factory Method pattern is a creational pattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.
- The Factory Method pattern is used to create
Vehiclesobjects.
To run the application, you can use the following commands:
dotnet run