这样的东西不会编译,即使泛型类型的大小是恒定的
public unsafe struct CornerData<T> where T : unmanaged {
private fixed T _data[4]; // CS1663: Fixed size buffer type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double [Assembly-CSharp]
}
为什么固定大小的缓冲区不允许unmanaged
关键字包含其他类型,或者这可能是引入关键字时的疏忽吗?
看起来它被遗漏了,但现在正在中
https://github.com/dotnet/csharplang/blob/9586b1e3388e367d62c2d3314306c4ed6920d873/proposals/fixed-sized-buffers.md