无法将'x'类型的对象转换为'x'类型

编程入门 行业动态 更新时间:2024-10-09 06:26:48
本文介绍了无法将'x'类型的对象转换为'x'类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我已经生成(使用xsd)报告的c#代码版本 定义用于报告服务中的2005版报告。我 在本地使用它,我能够反序列化已创建的 报告。然后我将代码(仅)移动到我的主项目中。我访问 rdlc文件就好了,我可以读它们没问题,但是一分钟我就试试以下内容我得到了上面的错误, _reportDef =(Rdl.Report)ser.Deserialize(fileStream); 我不知道为什么会出现这种情况....任何人都可以放弃任何关于这个问题,这是什么意思? 万分感谢!!

Hi everyone, I have generated (using xsd) the c# code version of the report definition used for 2005 version of reports in reporting services. I was using it locally and I was able to deserialize already created reports. I then move the code (only) into my main project. I access the rdlc files just fine, i can read them no problem, but the minute I try the following I get the above error, _reportDef = (Rdl.Report)ser.Deserialize(fileStream); I have no idea why this might be the case....can anyone shed any light on the matter? Thanks a million!!

推荐答案

6月27日下午4:29,ron1 ... @ gmail写道: On Jun 27, 4:29 pm, ron1...@gmail wrote: 我已经生成(使用xsd)c#代码报告版本 定义用于报告服务中的2005版报告。我 在本地使用它,我能够反序列化已创建的 报告。然后我将代码(仅)移动到我的主项目中。我访问 rdlc文件就好了,我可以读它们没问题,但是一分钟我就试试以下内容我得到了上面的错误, _reportDef =(Rdl.Report)ser.Deserialize(fileStream); 我不知道为什么会出现这种情况....任何人都可以放弃任何光亮 就此事? I have generated (using xsd) the c# code version of the report definition used for 2005 version of reports in reporting services. I was using it locally and I was able to deserialize already created reports. I then move the code (only) into my main project. I access the rdlc files just fine, i can read them no problem, but the minute I try the following I get the above error, _reportDef = (Rdl.Report)ser.Deserialize(fileStream); I have no idea why this might be the case....can anyone shed any light on the matter?

序列化数据可能说明了类型所属的汇编, 和反序列化将尊重这一点。然后你试着把它投到 a不同的类型 - 一个在你的主项目中。 Jon

The serialized data probably says which assembly the type belongs to, and deserialization will honour that. You''re then trying to cast it to a different type - one which is within your main project. Jon

您好 ro*****@gmail , 检查反序列化对象是否等于铸造(完整类型信息,使用 调试器)。 亲切的问候,Alex Meleta [TechBlog] devkids.blogspot Hi ro*****@gmail, Checks that a deserialized object is equal to casted (full type info, using debugger). Kind Regards, Alex Meleta [TechBlog] devkids.blogspot 大家好, 我已经生成(使用xsd)报告的c#代码版本 报告服务中用于2005版报告的定义。我 在本地使用它,我能够反序列化已创建的 报告。然后我将代码(仅)移动到我的主项目中。我访问 rdlc文件就好了,我可以读它们没问题,但是一分钟我就试试以下内容我得到了上面的错误, _reportDef =(Rdl.Report)ser.Deserialize(fileStream); 我不知道为什么会出现这种情况....任何人都可以放弃任何光线 有关此事? 万分感谢!! Hi everyone, I have generated (using xsd) the c# code version of the report definition used for 2005 version of reports in reporting services. I was using it locally and I was able to deserialize already created reports. I then move the code (only) into my main project. I access the rdlc files just fine, i can read them no problem, but the minute I try the following I get the above error, _reportDef = (Rdl.Report)ser.Deserialize(fileStream); I have no idea why this might be the case....can anyone shed any light on the matter? Thanks a million!!

您好, < ro ***** @ gmail写信息 新闻:11 ************ **********@o11g2000prd.googlegr oups ... Hi, <ro*****@gmailwrote in message news:11**********************@o11g2000prd.googlegr oups... 大家好, 我已生成(使用xsd)报告的c#代码版本 定义用于报告服务中的2005版报告。我 在本地使用它,我能够反序列化已创建的 报告。然后我将代码(仅)移动到我的主项目中。我访问 rdlc文件就好了,我可以读它们没问题,但是一分钟我就试试以下内容我得到了上面的错误, _reportDef =(Rdl.Report)ser.Deserialize(fileStream); Hi everyone, I have generated (using xsd) the c# code version of the report definition used for 2005 version of reports in reporting services. I was using it locally and I was able to deserialize already created reports. I then move the code (only) into my main project. I access the rdlc files just fine, i can read them no problem, but the minute I try the following I get the above error, _reportDef = (Rdl.Report)ser.Deserialize(fileStream);

你可能想要在另一种类型中反序列化。 这样做: Console.WriteLine(_reportDef.GetType()。FullName); object o = ser.Deserialize(fileStream); Console.WriteLine(_o.GetType ().FullName); 看看是否有任何区别。

Must probably you are trying to deserialize in another type. Do this: Console.WriteLine( _reportDef.GetType().FullName); object o = ser.Deserialize(fileStream); Console.WriteLine( _o.GetType().FullName); And see if there is any difference.

更多推荐

无法将'x'类型的对象转换为'x'类型

本文发布于:2023-11-26 05:15:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1632776.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类型   转换为   对象

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!