Implement IReadOnlyList for State
This commit is contained in:
parent
8c3caa06d5
commit
19188fa430
|
@ -1,6 +1,8 @@
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
namespace InnovEnergy.Lib.Units;
|
namespace InnovEnergy.Lib.Units;
|
||||||
|
|
||||||
public readonly struct State
|
public readonly struct State : IReadOnlyList<String>
|
||||||
{
|
{
|
||||||
public IReadOnlyList<String> Values { get; }
|
public IReadOnlyList<String> Values { get; }
|
||||||
|
|
||||||
|
@ -25,5 +27,11 @@ public readonly struct State
|
||||||
|
|
||||||
public static State operator |(State left, State right) => new(left, right);
|
public static State operator |(State left, State right) => new(left, right);
|
||||||
|
|
||||||
|
public IEnumerator<String> GetEnumerator() => Values.GetEnumerator();
|
||||||
|
|
||||||
public override String ToString() => String.Join("; ", Values);
|
public override String ToString() => String.Join("; ", Values);
|
||||||
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||||
|
|
||||||
|
public Int32 Count => Values.Count;
|
||||||
|
public String this[Int32 index] => Values[index];
|
||||||
}
|
}
|
Loading…
Reference in New Issue