M
Max
I know that in VB.Net I don't need to check if an events has some listeners,
because raiseevent do that for me...
but I WANT know if the event has some listeners, because IF it has someone,
I do some cpu intensive works.
Public Event CarRead(ByVal sender As Object, ByVal MyData As
MyLittleInformation)
Protected Overridable Sub OnCarRead(ByVal MyData As MyLittleInformation)
Dim MyDataInternal as MyBigData
MyDataInternal =
MyBigProcedureThatRequireManyReoursesToPrepareMyData(MyLittleInformation)
RaiseEvent CarRead(Me, MyDataInternal)
MyBigProcedureThatRequireManyReoursesToAnalyzeMyData(MyDataInternal)
End Sub
The 2 procedure MyBigProcedureThatRequireManyReoursesToPrepareMyData /
MyBigProcedureThatRequireManyReoursesToAnalyzeMyData
require time and resources, so it's a bad thing to execute them if there are
no event listeners.
But I don't know how to check if there are event listener in VB.Net.
Hwo can I handle this in VB.Net?
Thanks, Max
because raiseevent do that for me...
but I WANT know if the event has some listeners, because IF it has someone,
I do some cpu intensive works.
Public Event CarRead(ByVal sender As Object, ByVal MyData As
MyLittleInformation)
Protected Overridable Sub OnCarRead(ByVal MyData As MyLittleInformation)
Dim MyDataInternal as MyBigData
MyDataInternal =
MyBigProcedureThatRequireManyReoursesToPrepareMyData(MyLittleInformation)
RaiseEvent CarRead(Me, MyDataInternal)
MyBigProcedureThatRequireManyReoursesToAnalyzeMyData(MyDataInternal)
End Sub
The 2 procedure MyBigProcedureThatRequireManyReoursesToPrepareMyData /
MyBigProcedureThatRequireManyReoursesToAnalyzeMyData
require time and resources, so it's a bad thing to execute them if there are
no event listeners.
But I don't know how to check if there are event listener in VB.Net.
Hwo can I handle this in VB.Net?
Thanks, Max