C#强制转换为对象

时间:2017-07-31 10:25:32

标签: c# casting

我遇到了与演员有关的问题。 我有域类

public class Product: Entity<int>
{
  //....
}

我有包装

public class  CommonWrapperDTO<T> where T : Entity<int>
{
   public T content {get; set;}
   public string[] Information {get; set;}
}

所以,我需要转换

//variable "result" have type a CommonWrapperDTO<Product>
var resultValue = result as CommonWrapperDTO<Entity<int>>;

as会返回null

我做错了什么?

0 个答案:

没有答案