NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error C3608

cannot take sizeof a managed array

The sizeof operator gets the value of an object at compile time. The size of a managed array (or managed class) is dynamic and cannot be known at compile time.

For example, the following sample generates C3608:

#using <mscorlib.dll>
void main() {
   int i;
   __gc int arr[];
   arr = new __gc int[6];
   i = sizeof(arr);   // cannot use sizeof on managed array
   Console::Out->WriteLine(i);
}