vb6 代码Public Function vb_function(com As Integer, str As String) As Byte()
vb_function = head2()
End Functionc#byte[] i2 = (byte[])led.vb_function(ref com_port, ref str);c#这边这样写报错,提示说不能将System.Byte[]转换为System.Byte[*]

解决方案 »

  1.   

    Public Function foo() As Byte()
        Dim a(2) As Byte
        a(0) = 1
        a(1) = 2
        a(2) = 3
        foo = a
    End Functionusing System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using 工程1;namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Class1 c = new Class1();
                Array a = c.foo();
                byte[] b = a.Cast<byte>().ToArray();
                foreach (byte item in b)
                {
                    Console.WriteLine(item);
                }
            }
        }
    }1
    2
    3
    Press any key to continue . . .