Innovenergy_trunk/csharp/Lib/Units/State.cs

18 lines
646 B
C#

namespace InnovEnergy.Lib.Units;
public readonly struct State
{
public IReadOnlyList<String> Values { get; }
public State(IReadOnlyList<String> values) => Values = values;
public State(params String[] values) : this((IReadOnlyList<String>)values){}
public State(params State[] states) : this(states.SelectMany(s => s.Values).ToList()){}
public State(Enum e) : this(e.ToString()){}
public static implicit operator State(Enum e) => new State(e);
public static implicit operator State(String s) => new State(s);
public static State operator +(State left, State right) => new State(left, right);
}