This documentation is archived and is not being maintained.

Compiler Error C2693

'operator' : illegal comparison for references to a __gc array

You cannot test a __gc array for any kind of inequality. For example, you can test to see if managed arrays are equal but you cannot test to see if one array is greater or less than another array.

For example, the following sample generates C2693:

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

int func1(int a __gc[], int b __gc[])
   return a != b;   // OK

int func2(int a __gc[], int b __gc[])
   return a == b;   // OK

int func3(int a __gc[], int b __gc[])
   return a < b;    // C2693