This error is generated if you try to check a trivial event for null (the event name will no longer provide direct access to the backing store delegate for the event). Ex:
// compile with: /clr /c
using namespace System;
public delegate int MyDel(int);
interface struct IEFace {
event MyDel ^ E;
};
ref struct EventSource : public IEFace {
virtual event MyDel ^ E;
void Fire_E(int i) {
if (E) // C3918
E(i);
}
};
Write the solution section and give other code examples that may trigger this error to improve the article.
This article is a derivative work based on Compiler Error C3918 which is provided by MSDN Community Content - Visual C++.