What the hell does this mean? 忽略返回,获取,结果将被展平并卡在应用程序内存中(所以这将是一个集...可能)
"Could not find an implementation of the query pattern for source type 'System.Linq.IQueryable'. 'Join' not found. Consider explicitly specifying the type of the range variable 'a'."
private CommonDataResponse toCommonData
{
get
{
CommonDataResponse toCommonData = this.gatewayReference.GetCommonData();
Array dCountries = toCommonData.PropertyCountries.ToArray(); //Webservice sends KeyValuePairOfString
Array dRegions = toCommonData.Regions; //Webservice sends Array
Array dAreas = toCommonData.Areas; //Webservice sends Array
var commonRAR = from a in dAreas
join r in dRegions
on a.RegionID equals r.Id
join c in dCountries
on r.CountryCode equals c.Key
select new {c.Value, r.Name, a.Name, a.Id };
return toCommonData;
}
}
dRegions / dAreas两个数组,dCountries是.toArray()
1 回答
Array
是一个非常松散的类型,并没有实现IEnumerable<T>
等 . 您可以尝试将Array
行切换为var
(让编译器选择类型) . 如果它仍然使用Array
,则可能使用.Cast<T>()
指定类型(或Array.ConvertAll
等) .从
Array
(没有更多信息),它知道的全部是object
.基本上,
Join
在IEnumerable<T>
和IQueryable<T>
上定义(作为扩展方法) - 而不是IEnumerable
(没有<T>
) .