2009-05-29 108 views
0

我继承了Windows移动部件的项目。长话短说,我的问题是这样的:将类型T的对象转换为类型T <System.Guid>

[DBPropertyUpdate("CustomerId")] 
[DBPropertyRetrieve("CustomerId")] 
public CustomerBase<T> Customer 
{ 
    get { return _customer; } 
    set { _customer = SetProperty(_customer, value); } 
} 

引发异常。

在监视窗口,我有以下:

> NAME   VALUE       TYPE 

_customer {Pss.Common.Mia.Customer} Pss.Common.Mia.CustomerBase<System.Guid> {Pss.Common.Mia.Customer} 
(Pss.Common.Mia.CustomerBase<System.Guid>)_customer Cannot convert type 'Pss.Common.Mia.CustomerBase<T>' to 'Pss.Common.Mia.CustomerBase<System.Guid>' 

我不熟悉这个代码,但希望会有转换'Pss.Common.Mia.CustomerBase<T>' to 'Pss.Common.Mia.CustomerBase<System.Guid>' 的seconcd观看条目是我的学尝试一些简单的方法,其因为你可以看到失败。

+0

什么是_customer定义为函数的工作?我认为我们没有足够的资源给你一个完整的答案...... – 2009-05-29 12:17:04

回答

1

作为CustomerBase <Guid>键入的变量_customer不能转换为CustomerBase <T>,因为T未知。您还必须键入_customer作为CustomerBase <T>才能使用。

0

得到它通过传递CustomerBase<Guid>类型为它建立了客户对象

相关问题