public class comm:CommLine
{
              public void SendCommand(string s)
}唉,自己慢点写吧,VB的SUB过程
C#用无返回值的函数。

解决方案 »

  1.   

    1 用专用的 VBNETConvertToC# 工具。2 先编译 VB.NET 工程,然后用反编译器反编译成 C# 代码。3 手工重写
      

  2.   

    using CommBase;namespace YourNameSpace
    {
    public class comm:CommLine
    {
        public void SendCommand(string s)
        {
            Send(s);
        }    public void TransactCommand(string s)
        {
            string r;
            r = Transact(s);
            Console.WriteLine("RESPONSE: " + r);
            Prompt();
        }    public void Prompt()
        {
            Console.WriteLine("Type string to send and press ENTER. Empty string to close com port.");
        }    protected override CommBaseSettings CommSettings()
        {
            CommLineSettings cs = new CommLineSettings();
            cs.SetStandard("COM2:", 57600, Handshake.XonXoff);
            cs.rxFilter = new ASCII[]{ASCII.LF, ASCII.SOH};
            cs.rxTerminator = ASCII.CR;
            cs.txTerminator = new ASCII[] {ASCII.CR};
            Setup(cs);
            return cs;
        }    protected overrides void OnRxLine(String s)
        {
            Console.WriteLine("RECEIVED: " + s);
            Prompt();
        }    protected override void OnTxDone()
        {
            Console.WriteLine("TRANSMISSION COMPLETE");
            Prompt();
        }}
    }