我的代碼如下。從List <EntityObject>轉換爲EntityObject
public void CreateNewAuthor(List<Author> newAuthor)
{
publishContext.AddToAuthors(newAuthor);
}
我知道這將導致錯誤的AddToAuthors(作者newAuthor)接受實體對象作爲參數,而我傳遞一個List <>。那麼應該如何處理?如何在AddToAuthors()之前將實體對象轉換成列表<>?
列表是作爲名稱最高審計機關一個對象名單「。那麼,您想如何將10位作者的列表轉換爲1位作者? –
也許你應該將你的變量重命名爲'newAuthors' – Jodrell