How is it that a struct containing ValueTuple can satisfy unmanaged constraints, but ValueTuple itself cannot?

浪子不回头ぞ 提交于 2019-12-04 01:49:57

Thanks for reporting. This is just a bug in the compiler. The tuple when used as a field should be registering as a generic type and hence invalid in an unmanaged type. It appears to be evaluating as a tulpe instead and missing this check.

Good news is that in C# 8.0 this restriction will be going away. The type (int, int) is a valid unmanaged type.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!