猿问

如何从foreach循环中的linqQuery获取数组中的多个值?

我想在foreach循环中执行的Array中获取查询结果,我有自定义类,但是每当我尝试将其保存在变量中时,它都会显示错误:


无法将genriccustom类转换为我的自定义类


var userName = HttpContext.Current.User.Identity.Name;


                    var result = entities.USERS.SingleOrDefault(x => x.USER_NAME.Equals(userName, StringComparison.OrdinalIgnoreCase));



                    var Result = (from p in entities.Apps where p.USERID == result.USERID select p).ToList();


                    var children = new List<InsuredSummary>();


                    foreach (var queryresult in Result)

                    {

                        var query_result = (from b in entities.USERS

                                                // join c in entities.APP_INFORMATION on Result.INSURED_APPLICATION_ID equals c.INSURED_APPLICATION_ID

                                                // join d in entities.APP_INFO_VEHICLE on Result.INSURED_APPLICATION_ID equals d.INSURED_APPLICATION_ID

                                                //  join e in entities.APP_INFO_VEHICLE_OPTIONS_ACCESSORIES on Result.INSURED_APPLICATION_ID equals e.INSURED_APPLICATION_ID

                                            join f in entities.Apps.Where(y => y.INSURED_APPLICATION_ID == queryresult.INSURED_APPLICATION_ID) on b.USERID equals f.USERID


白衣染霜花
浏览 167回答 1
1回答
随时随地看视频慕课网APP
我要回答