遵循这段代码,我在LinqPad 4中使用了“动态CRM LinqPad驱动程序”。它将针对CRM Online实例执行代码。同时,执行此代码我无法隐式转换类型System.Linq.IQueryable' to' UserQuery.Container1'。存在显式转换(您是否错过了演员?)'在突出显示的BOLD行。
void Main() {
string[] chosenOnes = {
"oamaweral@abc.com",
"rflefel@abc.com",
};
IQueryable<Container1> zVar = ContactSet.Where(a => a.EMailAddress1 == "uiuiyh@abc.com")
.Select( a => new Container1() { FullName = a.FullName } );
foreach(string element in chosenOnes)
**zVar.Concat(new Container1[]{(ContactSet.Where(a => a.EMailAddress1 == element)
.Select( a => new Container1() { FullName = a.FullName } ))} );**
zVar.Dump();
}
// Define other methods and classes here
public class Container1
{
public string FullName {get; set; }
}
答案 0 :(得分:0)
您的阵列初始化尝试不正确。只需使用ToArray()
代替:
zVar.Concat(
ContactSet.Where(a => a.EMailAddress1 == element)
.Select(a => new Container1() { FullName = a.FullName })
.ToArray()
);