public interface IMyControl<in T> where T : ICoreEntity
{
void SetEntity(T dataObject);
}
public class MyControl : UserControl, IMyControl<DataObject> // DataObject implements ICoreEntity
{
void SetEntity(T dataObject);
}
到目前为止一切都很好,但是为什么这会产生空值?
var control = LoadControl("~/Controls/MyControl.ascx"); // assume this line works
IMyControl<ICoreEntity> myControl = control;
myControl 现在为空...