无法生成临时类(结果= 1)。错误CS0030:无法将类型'类型[]'到'类型'? [英] Unable to generate a temporary class (result=1). error CS0030: Cannot convert type 'Type[]' to 'Type'?

查看:999
本文介绍了无法生成临时类(结果= 1)。错误CS0030:无法将类型'类型[]'到'类型'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到这个错误我使用xsd.exe工具创建的类之后,从我的xsd文件。所以我搜索网,找到了解决办法。这里是链接:<一个href=\"http://satov.blogspot.com/2006/12/xsdexe-generated-classes-causing.html\">http://satov.blogspot.com/2006/12/xsdexe-generated-classes-causing.html

I get this error after I created a class from my xsd file using the xsd.exe tool. So I searched the net and found a solution. Here is the link: http://satov.blogspot.com/2006/12/xsdexe-generated-classes-causing.html

问题是,这使得code运行,但不知何故反序列化的数据似乎已损坏。我做了该网站显示,并在最后第2个数组大小始终是空的(见网站的评论,有人也有这个问题)。问题是,我怎么现在解决这个问题?是否有其他工具来创建XSD文件?我试图Xsd2 code,没有成功。

Problem is that this makes the code run, but somehow the deserialized data seems corrupt. I did what the site suggests and in the end the 2nd array dimension is always empty (see the comments of the site, somebody also had this problem). Question is, how do I solve this issue now? Is there another tool to create the xsd file? I tried Xsd2Code, without success.

感谢: - )

推荐答案

您需要改变一个成员变量的类型,序列化类。例如,如果它引发错误,如:

You need to change the type of a member variable in the serialized class. For example if its raising an error like:

无法生成临时类(结果= 1)。
  错误CS0030:无法将类型'数据[]到数据

Unable to generate a temporary class (result=1). error CS0030: Cannot convert type 'Data[]' to 'Data'.

我跑在生成的文件中的数据类型名称的搜索,我发现这一点:

I ran a search on the Data type name in the generated file, and I found this:

[System.Xml.Serialization.XmlArrayItemAttribute("Data", typeof(Data), IsNullable=false)]
public Data[][] Row

替换数据[] [] 数据[] - 更改类型数据从2D阵列为一维数组。这将解决您的问题。 :)

Replace Data[][] with Data[] - Change the type of Data from a 2D array to a 1D array. It would solve your problem. :)

这篇关于无法生成临时类(结果= 1)。错误CS0030:无法将类型'类型[]'到'类型'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆