我的asp.net mvc web应用程序中有以下代码: -
public void syncWithEX()
{
var EXresource = entities.Resources.Select(g => new
{
EXID = g.RESOURCEID,
CurrentEXSiteID = g.ResourceLocation.SITEID
}).ToDictionary(a => a.EXID, a => a.CurrentEXSiteID);
var technology = ITSys.Technologies.Select(g => new
{
ID = g.TechnologyID,
EXID = g.EXID
}).ToDictionary(a => a.ID, a => a.EXID);
var server = ITSys.ITSYSServers.Where(a => !a.Technology.IsDeleted && a.Technology.IsCompleted);
foreach (var s in server)
{
long? EXid = technology[s.ITSYSServerID];
if (EXresource.ContainsKey[EXid.Value] )
{
long? CurrentEXsiteid = EXresource[EXid.Value];
if (CurrentEXsiteid != s.EXSiteID)
{
s.EXSiteID = CurrentEXsiteid.Value;
ITSys.Entry(s).State = EntityState.Modified;
}
}
}
但我收到以下错误:
无法将[]索引应用于“方法组”
类型的表达式
以下代码:
if (EXresource.ContainsKey[EXid.Value] )