Error al traducir de C# a VB

29/03/2005 - 19:16 por westroberto | Informe spam
Tengo el siguiente código en C#

*** CSharp
public class PersonData
{
private delegate void updateDelegate(ArrayList list);

public static void upList(ArrayList list)
{
PersonData pd = new PersonData();
updateDelegate del = new updateDelegate(pd.updateList);
del.BeginInvoke(list, null, null);
}
}

al intentar traducirlo a VB

*** VB
Public Class PersonData
Private Delegate Sub UpdateDelegate(ByVal list As ArrayList)

Public Shared Sub UpList(ByVal list As ArrayList)
Dim pd As PersonData = New PersonData
Dim del As UpdateDelegate = AddressOf UpdateList
del.BeginInvoke(list, Nothing, Nothing)

End Sub

End Class

me da el siguiente error en la línea:
Dim del As UpdateDelegate = AddressOf UpdateList

No se puede hacer referencia a un miembro de instancias de una clase
desde un método compartido o un inicializador de métodos compartido
sin una instancia explícita de la clase.

¿Alguien tiene idea de como tendría que tratar este tema? Manteniendo
el procedimiento de tipo "Shared" porsupuesto.
 

Leer las respuestas

#1 Eduardo A. Morcillo [MS MVP VB]
29/03/2005 - 21:40 | Informe spam
Fijate que te falta "pd." en el addressof.

Eduardo A. Morcillo [MS MVP VB]
http://www.mvps.org/emorcillo
https://mvp.support.microsoft.com/p...4EF5A4191C

Preguntas similares