using System; public class ST_1 { private readonly float[] _span = new float[4]; public float a { get => _span[0]; set => _span[0] = value; } public float b { get => _span[1]; set => _span[1] = value; } public float c { get => _span[2]; set => _span[2] = value; } public float d { get => _span[3]; set => _span[3] = value; } public ST_1(float a, float b, float c, float d) => (this.a, this.b, this.c, this.d) = (a, b, c, d); public ST_1(float[] f) : this(f[0], f[1], f[2], f[3]) { } public ST_1() : this(0f, 0f, 0f, 0f) { } } public class ST_2 { public float value1 { get; set; } public ST_1 structData { get => new ST_1(valueArray); } public float[] valueArray { get; init; } }
class Program { static void Main() { ST_2 x = new ST_2 { value1 = 1.23f, valueArray = new float[] { 2.34f, 3.45f, 4.56f, 5.67f } };