123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- namespace InABox.WPF
- {
- // public class StringCalculator : AbstractCalculator<string, StringCombinerFunction>
- // {
- //
- // public string Separator { get; set; }
- // protected override string Combine(string current, string next)
- // {
- // return Function switch
- // {
- // StringCombinerFunction.Append => string.Join(Separator, new [] { current, next } ),
- // _ => current
- // };
- // }
- // }
-
- public class StringCalculatorFunction : AbstractCalculatorFunction<string, StringCalculatorType>
- {
- public string Separator { get; set; }
- protected override string Calculate(string current, string next, StringCalculatorType type)
- {
- var result = type switch
- {
- StringCalculatorType.Append => string.Join(Separator, new [] { current, next } ),
- _ => current
- };
- return result;
- }
- }
-
- public class StringCalculator : AbstractCalculator<string, StringCalculatorFunction, StringCalculatorType>
- {
-
- public string Separator
- {
- get => Function.Separator;
- set => Function.Separator = value;
- }
-
- }
- }
|