Design Pattern Examples
Overview of object-oriented design patterns
Bridge_Exercise Class Reference

Example of using the Bridge Pattern in C#. More...

Collaboration diagram for Bridge_Exercise:
Collaboration graph

Public Member Functions

void Run ()
 Executes the example for the Bridge Pattern in C#.
 

Private Member Functions

void _Bridge_Exercise_Demonstrate_Logging (Logger logger, string loggerType)
 Helper function to show an example of writing to a logger.
 

Detailed Description

Example of using the Bridge Pattern in C#.

The Bridge pattern is used to allow a program to offer multiple ways to perform logging without changing how the logging is used throughout the program.

In this exercise, note how the calls into the logger are the same regardless of the logger used.

Definition at line 20 of file Bridge_Exercise.cs.

Member Function Documentation

◆ _Bridge_Exercise_Demonstrate_Logging()

void _Bridge_Exercise_Demonstrate_Logging ( Logger  logger,
string  loggerType 
)
inlineprivate

Helper function to show an example of writing to a logger.

This is called for all types of loggers, showing how the Logger class hides the details of the underlying implementation.

Parameters
loggerA Logger instance to log to
loggerTypeThe type of the underlying implementation.

Definition at line 30 of file Bridge_Exercise.cs.

References Logger.LogError(), Logger.LogInfo(), and Logger.LogTrace().

Referenced by Bridge_Exercise.Run().

◆ Run()

void Run ( )
inline

Executes the example for the Bridge Pattern in C#.

Definition at line 42 of file Bridge_Exercise.cs.

References Bridge_Exercise._Bridge_Exercise_Demonstrate_Logging().

Referenced by Program.Run().


The documentation for this class was generated from the following file: