私は.NETの世界の初心者です。LINQから何らかの結果を達成しようとしていました。助けてください。
以下は私が得ているエラーです。
エラー 4 型 'System.Linq.IQueryable' を 'System.Collections.Generic.List' に暗黙的に変換できません。明示的な変換が存在します (キャストがありませんか?) ..Business\DAL\GlobalRequest.cs 39 27 ビジネス
public ObservableCollection<AccountSummary> GetAccountSummary()
{
ObservableCollection<AccountSummary> list;
list = from ListData in
(from a in dbc.Accounts
join b in dbc.Ledgers on a.Account_ID equals b.Account_ID into t2
from t2Data in t2.DefaultIfEmpty()
where a.Is_Mannual == Convert.ToChar("Y")
select new
{
Account_ID = a.Account_ID,
Account_Name = a.Account_Name,
Amount = t2Data.Amount == null ? 0 : t2Data.Amount
}
).OrderBy(item => item.Account_Name)
group ListData by new
{
ListData.Account_ID,
ListData.Account_Name
} into GroupData
select new
{
Account_ID = GroupData.Key.Account_ID,
Account_Name = GroupData.Key.Account_Name,
Amount = GroupData.Sum(OL => OL.Amount)
};
}
class AccountSummary
{
public decimal AccountID { get; set; }
public string AccountName { get; set; }
public decimal Amount { get; set; }
}
ご意見をお聞かせください。