我有這樣的代碼:無法隱式轉換類型...到...問題
public static IEnumerable<dcCustomer> searchCustomer(string Companyname)
{
TestdbDataContext db = new TestdbDataContext();
IEnumerable<dcCustomer> myCustomerList = (from Customer res
in db.Customers
where res.CompanyName == Companyname
select res);
return myCustomerList;
}
而且不管我嘗試我不斷收到轉換錯誤。
Error 1 Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<ConnectionWeb.Customer>' to 'System.Collections.Generic.IEnumerable<ConnectionWeb.DAL.dcCustomer>'. An explicit conversion exists (are you missing a cast?) \\srv01\home$\Z****\Visual Studio 2008\Projects\ConnectionWeb\ConnectionWeb\DAL\dcCustomer.cs 63 20 ConnectionWeb
我想嘗試讓myCustomerList將值保存在枚舉器中並將其返回。
感謝您的回答! – Younes 2010-04-23 08:02:18