Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error C3142
Collapse the table of content
Expand the table of content

Compiler Error C3142

'property_name' : you cannot take the address of a property

The address of a property is not available to the developer.

The following sample generates C3142:

// C3142_2.cpp
// compile with: /clr
using namespace System;
ref class CSize {
private:
   property int Size {
      int get();
   }
};

int main() {
    &CSize::Size; // C3142
}

The following sample generates C3142:

// C3142.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
using namespace System;

__gc class CSize
{
   __property int get_Size();
};

int main()
{
   &CSize::Size;   // C3142
}
Show:
© 2015 Microsoft