【发布时间】:2018-04-03 04:35:34
【问题描述】:
这是我正在尝试做的事情,甚至不确定是否可能..
我正在创建 BaseViewModel<T>,我希望它接受从 Entity 继承的类型
考虑这段代码:
public abstract class BaseViewModel<T> : NotificationObject, INavigationAware
{
public T MyEntity;
public SomeMethod()
{
MyEntity.SomeEntityProperty = SomeValue;
}
}
所以,我想说我的 T 继承自 Entity,因此我知道它将具有 SomeEntityProperty。
这可能吗?
【问题讨论】: