Class UserInputTemplate
- Namespace
- WitShells.DesignPatterns.Core
Example template that parses a raw string into an integer, with logging at each step.
public class UserInputTemplate : TemplateMethod<string, int>
- Inheritance
-
UserInputTemplate
- Inherited Members
Methods
PostProcess(int)
Step 3: Post-processing logic run after the main processing. Override to log, cache, or dispatch the result.
protected override void PostProcess(int result)
Parameters
resultintThe result produced by Process(TInput).
PreProcess(string)
Step 1: Preparation logic run before the main processing. Override to validate, sanitise, or log incoming data.
protected override void PreProcess(string input)
Parameters
inputstringThe raw input before processing.
Process(string)
Step 2: The core algorithm. Must be implemented by every subclass.
protected override int Process(string input)
Parameters
inputstringThe (pre-processed) input to transform.
Returns
- int
The intermediate result passed to PostProcess(TResult).