我用VB写了一个DLL。然后有个接口是Public Function DecryptString(ByRef EncryptByte() As Byte) As String。EncryptByte() 是一个长度不定的byte数组,然后我在C#里引用,然后就变成了DecryptString(ref System.Ayyay EncryptByte); 我怎么把我C#的byte[] buffer怎么转换成System.Ayyay类型然后传递给VB的DLL ByRef EncryptByte() As Byte)然后又人帮我实现
byte[] buffer= System.Text.Encoding.UTF8.GetBytes("input"); 
怎么把buffer 转换成System.Array

解决方案 »

  1.   


    byte[] buffer= System.Text.Encoding.UTF8.GetBytes("input"); buffer.CopyTo(array,0);
      

  2.   

    ....直接使用... 
    DecryptString(ref buffer);
      

  3.   

    buffer.CopyTo(array,0); 这个地方会错误 不能将源数组类型分配给目标数组类型。 能不能你在VS2005里写出来能运行的代码。
      

  4.   


    直接使用... 
    DecryptString(ref buffer); 错误 2 参数“1”: 无法从“ref byte[]”转换为“ref System.Array” D:\Work\CSHarpApp\CSHarpApp\Form2.cs 54 62 CSHarpApp
      

  5.   

               
    byte[] buffer= System.Text.Encoding.UTF8.GetBytes("input");  System.Array ar = new byte[buffer.Length];
                buffer.CopyTo(ar, 0);DecryptString(ref ar);
      

  6.   


                    Array tmpAry = buffer;
                    DecryptString(ref tmpAry); 
      

  7.   

    DecryptString(ref (Array)buffer);