Files
Beam/Beam/ImmutableState.cs
T
qwsdcvghyu89 a7d148a96f Introduce Beam.Fluent and Beam.Models projects
Added new Beam.Fluent and Beam.Models projects with staged download builder and data context models. Refactored and moved model classes from Beam.Temporary.Cli to Beam.Models. Added new data providers and extended DataBindings in Beam.Dynamic. Renamed Beam.Puppeteer to Beam.Playwright and updated related classes. Updated project references and package versions. Removed obsolete and unused files from Beam.Temporary.Cli.
2025-09-18 18:32:25 +10:00

32 lines
769 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Beam {
public readonly struct ImmutableState {
readonly string[] state;
[JsonConstructor]
public ImmutableState(string[] state) {
this.state = state ?? [];
}
public string[] State => state ?? [];
public readonly Span<string> AsSpan() => state ?? [];
public readonly State Copy()
=> new((string[])(state ?? []).Clone());
public readonly string this[Index i] {
get => state[i];
}
public static implicit operator State(ImmutableState state)
=> state.Copy();
}
}