Factory method Command

Factory method Command

Old forum URL: forums.lhotka.net/forums/t/10714.aspx


kermitfrosch posted on Monday, September 26, 2011

Hallo ng,

can anyone help me to translate this c# code to vb?

public static void Exists(int id, Action<bool> result)
    {
      var cmd = new ExistsCommand(id);
      DataPortal.BeginExecute<ExistsCommand>(cmd, (o, e) =>
        {
          if (e.Error != null)
            throw e.Error;
          else
            result(e.Object.Exists);
        });
    }

 

JonnyBee replied on Monday, September 26, 2011

Use this online converter:

http://www.developerfusion.com/tools/convert/csharp-to-vb/

Result:

Public Shared Sub Exists(id As Integer, result As Action(Of Boolean))
    Dim cmd = New ExistsCommand(id)
    DataPortal.BeginExecute(Of ExistsCommand)(cmd, Function(o, e)
    If e.[Error] IsNot Nothing Then
        Throw e.[Error]
    Else
        result(e.[Object].Exists)
    End If

End Function)
End Sub

kermitfrosch replied on Tuesday, September 27, 2011

Thanks,

 

i found this one:

http://converter.telerik.com/

 

 

Copyright (c) Marimer LLC