21 lines
677 B
C#
21 lines
677 B
C#
|
namespace InnovEnergy.Lib.StatusData;
|
||
|
|
||
|
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);
|
||
|
|
||
|
// parallel
|
||
|
public static State operator |(State left, State right) => new State(left, right);
|
||
|
}
|