0
我有2類: - BasePageElement(父) 和行動(BasePageElement的孩子)。不能鍵入 '表達<System.Func <TP,Action>>' 轉換爲 '表達<System.Func <TP,BasePageElement >>'
我有2種方法:
public void Click(Expression<Func<TP, Action>> action)
{
WaitSomething(action);
some code
}
public void WaitSomething(Expression<Func<TP, BasePageElement>> action)
{
}
所以我在點擊方法的問題,因爲類型表達< Func鍵< TP,動作>>無法轉換爲表達< Func鍵< TP,BasePageElement >>
如何我可以解決嗎?
我如何手動將Expression>轉換爲Expression >? –
iPogosov
您需要編寫一個轉換器函數,將Action從Expression中移出並將其轉換爲BasePageelement。 – Thomas