Method that in visual basic does not take parameters as it is done in C #

0

I'm doing the following code conversion from vb .net to c #

Thread hilo = new Thread(AddressOf ConcatenarArchivosHilos);
            hilos.Add(hilo);

where ConcatenarArchivosHilos has a parameter of an integer array

Private Sub ConcatenarArchivosHilos(ByVal indices() As Integer)
   'el resto del codigo
End Sub

when converting to c # convert it ( link )

Thread hilo = new Thread(ConcatenarArchivosHilos);

private void ConcatenarArchivosHilos(int[] indices)
 {
       //El resto de codigo
 }

in c # it would be normal for ConcatenarArchivosHilos to indicate an array of indices like this

 Thread hilo = Tread(concatenarArchivosHilos(Arrayindices))

but as you explain it comes from VB.net code where that portion of NO code has the parameter of the ConcatenateArchivosHilos method, can someone explain why?

Update

threads [linenumber] .Start (indexesAProcess); in this one taking the parameters to start threads.

The error that comes up at design time is can not convert from 'method group' to 'ThreadStart'

    
asked by ger 18.10.2018 в 21:12
source

1 answer

0

You could use something like being

Thread hilo = Tread(concatenarArchivosHilos);
hilo.Start(Arrayindices);

when defining the Start() is where you pass the parameters, analyze the documentation

Thread.Start Method

You will see an example of how the Start () method of the thread allows you to pass the parameters

    
answered by 18.10.2018 / 22:21
source