[英]Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true
I've got an extension for all entities: 我有一个所有实体的扩展:
public static class EntityBaseExtensions
{
public static T Clone<T>(this T item)
where T : EntityBase
{
return item.EntityClone<T>();
}
}
and 和
public virtual T EntityClone<T>() where T : EntityBase
{
return this.MemberwiseClone() as T;
}
but when i call it like: 但当我称之为:
var details = user.Details.Clone();
i get 我明白了
Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.
无法对ContainsGenericParameters为true的类型或方法执行后期绑定操作。
any ideas? 有任何想法吗?
the solution is kinda weird: 解决方案有点奇怪:
public static T Clone<T>(this T item)
where T : SimpleEntityBase
{
return (T)item.EntityClone();
}
and 和
public virtual object EntityClone()
{
return this.MemberwiseClone();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.