HellGate
HellGate

Reputation: 728

Any reason why Fixed Size Buffers do not support unmanaged Types?

Something like this wont compile even though the size of the generic type will be constant

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]
}

Is there any reason why fixed size buffers do not allow other types included with the unmanaged keyword or could this be an oversight when the keyword was introduced?

Upvotes: 1

Views: 315

Answers (1)

Related Questions