Compiler Error C2728
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Error C2728

cannot create non __gc array 'array' of type 'type'

A __nogc array cannot be of a __gc type.

The following sample generates C2728:

// C2728.cpp
// compile with: /clr
#using <mscorlib.dll>

int main()
   int __gc* arr __nogc[5];   // C2728
© 2015 Microsoft