home links tools blog about

AngryPets Blog

home

Delegates Rool and VB.NET Drools (Part II)


As a follow-up on my delegated delegates trick: It simply won't work in VB.NET - which requires a hard-coded method name.

What in the HELL is the point of a delegate if you can't pass it around as a variable? That's as useless as... udders... on a Bull.  Talk about stoooopid.

So instead of my beautiful logic before, I now have to load up a threadstart with the location - instead of just loading up a delegate, and passing that in to the threadstart:

Dim ts as ThreadStart = Nothing
Select Case OperationType
        case OperationType.Hard:
            ts = new ThreadStart(AddressOf me.HardHandler)
        case OperationType.ReallyHard:
            op = new OperationDelegate(AddressOf me.ReallyHardHandler)
        ' etc... 
End Select

If (ts <> Nothing) Then
    ' vb sucks:
    Dim operationHandler As Thread = New Thread(ts)
    operationHandler.IsBackground = True
    operationHandler.Start()
End If

That just feels so ... Fischer Price My First Threading Kit...


posted on Monday, September 12, 2005 4:10 PM
 

Existing Comments:

No comments posted yet

Add your own comment:


Go to http://blog.angrypets.com where comments are enabled.