English 中文(简体)
两个地点补习班
原标题:Compiled Class in Two Locations

I m a tad stuck trying to get a List to load from the ViewState using ASP.NET 4 and VB.NET. When I try to retrieve a collection using:

Public Property ItemsForImport As List(Of ImportItem)
    Get
        Return IIf(ViewState("ItemsForImport") Is Nothing, New List(Of ImportItem), CType(ViewState("ItemsForImport"), List(Of ImportItem)))
    End Get
    Set(value As List(Of ImportItem))
        ViewState("ItemsForImport") = value
    End Set
End Property

我例外:

[A]System.Collections.Generic.List`1[ImportItem] cannot be cast to [B]System.Collections.Generic.List`1[ImportItem]. 
Type A originates from  mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089  in the context  LoadNeither  at location  C:WindowsMicrosoft.NetassemblyGAC_32mscorlibv4.0_4.0.0.0__b77a5c561934e089mscorlib.dll . 
Type B originates from  mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089  in the context  LoadNeither  at location      C:WindowsMicrosoft.NetassemblyGAC_32mscorlibv4.0_4.0.0.0__b77a5c561934e089mscorlib.dll .

偷窃表明,收集工作没有结果,有2个项目。 这一类别仅作一次界定,我从C:Coricrosoft.NETFrameworkv4.0.30319中清理了我的临时档案。 临时伙伴关系网文件

总的来说,我有时看到(我假定每个人都会这样做)在进行快速变化的同时进行分解,但经过了两次复习。 是否有人失踪?

最佳回答

检查贵项目夹。 在解决办法中,你可能有一个重复的组合,造成冲突。 您是否有提及同一集会的母子项目?

阅读其中一些解决办法,看看问题是否适合:

InvalidCastException for two Objects of the same type

ASP.NET 封装

Error Rendering control - [A] cannot be cast to [B] in the context LoadNeither

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签