感谢您使用微软产品。在C#中,char[]实际上是System.Array类的子类,System.Char[]表示了destStr这个对象的类型。
如果要得到destStr中的内容,您可以使用destStr.GetValue(i)。关于Array类的更多信息,请参考
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemArrayClassTopic.asp- 微软全球技术中心 VC技术支持本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。

解决方案 »

  1.   

    acptvc(微软全球技术中心 VC技术支持):
    我知道System.Char[]表示的是destStr对象的类型,我想问你为什么执行这一句“string test="The encoded string is:"+destStr“会把destStr这个对象的类型与"The encoded string is:"字符串相联,你好像并没有回答这个问题?
      

  2.   

    因为在执行字符串连接时,系统会调用Array.ToString将destStr这个Array类的对象转化为字符串,也就得到了System.Char[].- 微软全球技术中心 VC技术支持本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
      

  3.   

    acptvc(微软全球技术中心 VC技术支持):
     如果执行下面这两条语句:
     string str1=new string(destStr);
     string test="The encoded string is:"+str1;
     那么test的值会是"The encoded string is:ezhofrp"
     也就是说,对于"+"操作符连接两个字符串而言,char[]类型和string类型是不同的!
    我查了MSDN,根据你所说,我找到了答案Array.ToString实际上是继承Object类的方法,而关于这个方法描述是:This method returns a human-readable string that is culture-sensitive. For example, for an instance of the Double class whose value is zero, the implementation of Double.ToString might return "0.00" or "0,00" depending on the current UI culture.The default implementation returns the fully qualified name of the type of the Object.Notes to Implementers:  This method can be overridden in a derived class to return values that are meaningful for that type. For example, the base data types, such as Int32, implement ToString so that it returns the string form of the value that the object represents. Derived classes that require more control over the formatting of strings than ToString provides should implement IFormattable, whose ToString method uses the current thread's CurrentCulture property.
    我现在想问的是"你怎么知道因为在执行字符串连接时,系统会调用Array.ToString将destStr这个Array类的对象转化为字符串,也就得到了System.Char[].",我想是不是有相关文档的说明?或是...?
    请在告知一二?