How can I check if an event will be raised?

How to check if an event will be raised in VB.NET? It seems I can do it in C #, but not in VB, although I use the same syntax.

Here is my VB.NET syntax (which returns an error)

If [EVENT] IsNot Nothing Then
End If

And here is my C # syntax (works fine)

If([EVENT] != null) //If an event is not null(nothing)
{
}

Here's the error that VB code returns

"[EVENT] is an event and cannot be called directly. Use the RaiseEvent expression to create an event.

+4
source share
2 answers

VB.Nets, , Event , , #, event Foo ,

If FooEvent IsNot Nothing Then
End If
+1

#, , , . , NullReferenceException.

VB.NET. , . #, ( ), raise. , , RaiseEvent. , .

+5

All Articles