Open sandboxFocus

Property CanRaise

CanRaise

Gets a value indicating whether the event can be raised.

Declaration
bool CanRaise { get; }
Property Value
Type Description
bool
Remarks

In C#, only field-like events (events without explicit add/remove accessors) can be raised because they have a backing delegate field that can be invoked. For non-field-like events (events with explicit accessors), there is no backing delegate to invoke, so this property returns false.

When this property returns false, calling Raise(params dynamic?[]) will throw an InvalidOperationException, and RaiseMethod will return null.