Użyłem narzędzia do konwersji C# na VB. Po uruchomieniu programu w VB pojawia się następujący błąd:Potrzebujesz pomocy w konwersji C# na VB
Events cannot be declared with a delegate type that has a return type.
Jak mogę poprawić ten kod?
C#:
using System;
[assembly: CLSCompliant(true)]
namespace Link.API
{
public delegate decimal DecimalStringDelegate(string s);
public delegate long OrderDelegateStatus(Order o);
public delegate void LongDelegate(long val);
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Link.API
{
public interface TLServer
{
event LongDelegate newOrderCancelRequest;
event OrderDelegateStatus newSendOrderRequest;
string ClientName(int clientnum);
bool SymbolSubscribed(string sym);
Basket AllClientBasket { get; }
}
}
VB.NET:
Imports System.Text
Imports System.Collections.Generic
Imports System
<Assembly: CLSCompliant(True)>
Namespace Link.API
Public Delegate Function DecimalStringDelegate(ByVal s As String) As Decimal
Public Delegate Function OrderDelegateStatus(ByVal o As Order) As Long
Public Delegate Sub LongDelegate(ByVal val As Long)
End Namespace
Namespace Link.API
Public Interface Server
Event newOrderCancelRequest As LongDelegate
Event newSendOrderRequest As OrderDelegateStatus
Function ClientName(ByVal clientnum As Integer) As String
Function SymbolSubscribed(ByVal sym As String) As Boolean
ReadOnly Property AllClientBasket() As Basket
End Interface
End Namespace
Jeśli mogę zapytać, _why_ ty konwersji tego kodu? C# i VB.NET odtwarzają _very_ dobrze razem, możesz mieszać klasy .NET, importować je od siebie itd. –
@BenjaminGruenbaum "możesz mieszać klasy .NET" nie w jednym projekcie - musiałby to być osobny zespół. –
Znalazłem [ten post] (http://www.vbforums.com/showthread.php?597718-Having-problem-converting-delegate-z-C-to-VB), mam nadzieję, że to pomaga. –