编译器错误 C2728

“type”:本机数组不能包含此类型

数组创建语法用于创建托管对象或 WinRT 对象的数组。 不能使用本机数组语法创建托管对象或 WinRT 对象的数组。

有关详细信息,请参阅 数组

以下示例将生成 C2728,并演示如何修复此错误:

// C2728.cpp
// compile with: /clr

int main() {
   int^ arr[5];   // C2728

   // try the following line instead
   array<int>^arr2;
}