Example of using the Strategy Pattern in C#. More...
Public Member Functions | |
void | Run () |
Executes the example for the Strategy Pattern in C#. | |
Private Attributes | |
EntryInformation[] | entries |
List of individuals to play around with in the Strategy exercise. | |
Example of using the Strategy Pattern in C#.
The Strategy pattern provides a way to easily assign different algorithms to a class instance that can be changed at the time the class is created.
In this exercise, the Strategy_ShowEntries_Class instance sorts and displays a list of EntryInformation elements. Three different sorting strategies are provided (Name, Age, Height) and an option to reverse the normal order of the sort.
Definition at line 22 of file Strategy_Exercise.cs.
|
inline |
Executes the example for the Strategy Pattern in C#.
Definition at line 41 of file Strategy_Exercise.cs.
References Strategy_Exercise.entries, and Strategy_ShowEntries_Class.ShowEntries().
Referenced by Program.Run().
|
private |
List of individuals to play around with in the Strategy exercise.
Definition at line 27 of file Strategy_Exercise.cs.
Referenced by Strategy_Exercise.Run().