No. In C #, there is no way to iterate 4. You can not decide where in memory will be placed .NET structor class. There is nothing like posting new C ++ .
But note that even Iteration 4 seems to have more problems than solutions:
At this stage, our iterations are not bad, but they see some recurring problems:
- Redistributing arrays when adding / removing components (Ive not considered this above - if you are not familiar with the problem, google "C dynamic array")
- ( Iteration 1, , , )
- ( )
struct , ...
public enum StructType
{
Velocity = 0,
Position = 1,
Foo = 2,
Bar = 3,
}
public struct Velocity
{
public int Vx;
public int Vy;
}
public struct Position
{
public int X;
public int Y;
public int Z;
}
public struct Foo
{
public double Weight;
public double Height;
public int Age;
}
public struct Bar
{
public int ColorR;
public int ColorG;
public int ColorB;
public int Transparency;
}
[StructLayout(LayoutKind.Explicit)]
public struct SuperStruct
{
[FieldOffset(0)]
public StructType StructType;
[FieldOffset(4)]
public Velocity Velocity;
[FieldOffset(4)]
public Position Position;
[FieldOffset(4)]
public Foo Foo;
[FieldOffset(4)]
public Bar Bar;
}
"" # C. , FixedLayout FieldOffset, . , , , , SuperStruct . 32 , Foo 20 , 8 .
, SuperStruct. , , Iterion 4, StructType , .