vb.net - Relaxed Delegate Conversion, and multiple method arguments -


I have this code:

  Friends sub head (argument as string) () T1 = new threading. Timer (Address MyTimerCallback) Dim t2 = New Threading.Timer (Enclosure MyTimer Callback, None, 0, 1000) End Sub-Private Sub MyTimer Callback () Some End All  

In the second line in the main :

is a compiler error on the first ARG 'argument' matching system matching mailback 'system. threading. Timer Callback 'P>

Threading. Timer constructor overload all a threading. Take the timer callback as the first argument, which is a representative that is a object argument. I understand that the first line is working, but why is not it working for the second line in main , which, with the first argument, using an additional surcharge of that constructor Does it?

In addition, it also works:

  dim t3 = new threading. Timer (New Threading Timer Callback (Encyclopedia MyTimerCallback), nothing, 0, 1000)  

Why this happens and no dim t2 = new threading. Timer (Entered MyTimerCallback, Nothing, 0, 1000) ?


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -