我想調用一個通用函數,它實現了一組接口的屬性。通用函數實現接口
代碼如下:
public bool NeedsRenderAction<M, U>(M parent, U child)
where M : IVrsnProps
where U : IVrsnProps
{
return true;
}
我打電話它下面的方式。從剃刀視角。
bool x = NeedsRenderAction<LayoutVrsn, WidgetVrsn>(Model.SPV, widget);
該調用甚至不會觸及該函數。 它錯誤的了:有一個從「layoutvrsn對象」到「IVrsnProps」
任何變通PLZ沒有隱式引用轉換...............
LayoutVrsn和WidgetVrsn是否實現了IVrsnProps? – graumanoz