Private Function DecodeUnicode(ByVal strUnicode As String) As String
        Dim GBCode As String
        Dim i, j As Integer
        Dim c() As String
        ReDim c(strUnicode.Length / 4)        For j = 0 To strUnicode.Length \ 4 - 1
            Dim d() As Char = strUnicode.ToCharArray(j * 4, 4)
            c(j) = "&H" & CType(d, String)
            c(j) = ChrW(Val(c(j)))
            GBCode += c(j)
        Next
        Return GBCode
    End Function

解决方案 »

  1.   

    private string DecodeUnicode(string strUnicode) 

     string GBCode; 
     int i; 
     int j; 
     string[][0] c; 
     for (int j = 0; j <= strUnicode.Length / 4 - 1; j++) { 
       char[][0] d = strUnicode.ToCharArray(j * 4, 4); 
       c(j) = "&H" + ((string)(d)); 
       c(j) = ChrW(Val(c(j))); 
       GBCode += c(j); 
     } 
     return GBCode; 
    }
      

  2.   

    string[][0] c;
    char[][0] d = strUnicode.ToCharArray(j * 4, 4); 
    定议出错呀!
      

  3.   

    http://www.kamalpatel.net/ConvertCSharp2VB.aspx
      

  4.   

    最简单的方法:编译后用Reflector再反编译成C#。
      

  5.   

    改成这样试试
    string[,0] c;
    char[,0] d = strUnicode.ToCharArray(j * 4, 4); 
      

  6.   

    http://www.developerfusion.com/utilities/convertvbtocsharp.aspx
      

  7.   

    private string DecodeUnicode(string strUnicode)
    {
    string GBCode=string.Empty;
    int j;
    string[] c;

    c=new string[strUnicode.Length / 4]; for(j = 0;j<strUnicode.Length / 4 - 1;j++)
    {
    char[] d = strUnicode.ToCharArray(j * 4, 4);

    c[j] = "0X" + this.CharArrayToString(d);
    c[j] =((char)Convert.ToInt32(c[j],16)).ToString();

    GBCode += c[j];
    } return GBCode;
    }private string CharArrayToString(char[] c)
    {
    string strReturn=string.Empty; foreach(char charThis in c)
    {
    strReturn+=charThis.ToString();
    } return strReturn;
    }
      

  8.   

    CType(d, String)是将字符数组中的字符转换为对应的字符串,C#中没有找到相应的方法,哪位仁兄找到了请告知,谢谢.
      

  9.   

    找到一个方法:StringBuilder strb=new StringBuilder();strb.Append(d);//返回字符串
    return strb.ToString();
      

  10.   

    dxq(懒虫)很利害呀!感激你的帮忙!希望可以跟你交个朋友!