This documentation is archived and is not being maintained.

__raise

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at __raise.

Emphasizes the call site of an event.

  
__raise   
method-declarator  
;  
  

From managed code, an event can only be raised from within the class where it is defined. See event for more information.

The keyword __raise causes an error to be emitted if you call a non-event.

System_CAPS_ICON_note.jpg Note

A templated class or struct cannot contain events.

// EventHandlingRef_raise.cpp  
struct E {  
   __event void func1();  
   void func1(int) {}  
  
   void func2() {}  
  
   void b() {  
      __raise func1();  
      __raise func1(1);  // C3745: 'int Event::bar(int)':   
                         // only an event can be 'raised'  
      __raise func2();   // C3745  
   }  
};  
  
int main() {  
   E e;  
   __raise e.func1();  
   __raise e.func1(1);  // C3745  
   __raise e.func2();   // C3745  
}  

Keywords
Event Handling
Component Extensions for Runtime Platforms

Show: