請耐心等待我我是新來的linq和有一個錯誤,我不明白任何幫助將不勝感激的幾個問題的問題。不能隱含轉換類型System.Collections.GenericList <AnonymousType#1>
- 我在我的問題的標題中收到的錯誤。
- 我的childproduct變量每個單獨的字符都會返回,我希望它們是productId和Childtext參數的字符串版本。
代碼:
public class AOAPlusChildModel
{
public List<string> LongName { get; set; }
public List<string> Text { get; set; }
public List<string> ProductId { get; set; }
public static List<AOAPlusChildModel> GetChildProducts()
{
List<AOAPlusChildModel> cp = new List<AOAPlusChildModel>();
List<AoaUserDefinedVWGetAOAPlusProducts> ChildProductsLists = AoaSvcClient.Client.Context.AoaUserDefinedVWGetAOAPlusProductss.Where(a => a.MasterProductFlag == false && a.Affiliate == "VA").ToList();
var childProducts = ChildProductsLists.SelectMany(p => p.LongName, (id, childtext) =>
new { ProductId = id.ProductId, Text = childtext }).ToList();
cp = childProducts.ToList();
return cp;
}
}
對不起不知道是否也貼我的完整的問題我childProducts可變回報我的產品編號,測試參數一次一個承租人。 – shermanb
至於第二個問題是什麼?AoaUserDefinedVWGetAOAPlusProducts?您需要顯示該類結構 –
AoaUserDefinedVWGetAOAPlusProducts是一個Web服務ProductId數據類型很長文本是字符串數據類型 – shermanb