Most code I've seen uses DirectCast inside DoWork for e.argument.
Is it bad practice to omit it if the variable datatype is the same?
Code:Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim theArguments() As String = {Checkbox1.Checked, Textbox1.Text} BackgroundWorker1.RunWorkerAsync(theArguments) End Sub Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork Dim theStrings() as String theStrings = e.Argument 'vs theStrings = DirectCast(e.Argument, String()) End Sub




Reply With Quote
