1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- namespace InABox.Avalonia.Converters;
- // 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;
- }
-
- }
|