将项添加到Observable Collection

时间:2014-02-24 21:21:49

标签: c#

我正在尝试添加一个Observable COllection。但是,当我这样做时,它不会添加2个不同的记录,而是只添加2个最新记录的副本。

using (var ctx = DB.Get())
   {        
   var Indepth = from z in ctx.Interactions
         where z.ActivityDate >= start && z.ActivityDate <= end && z.Indepth == true
         select new { Indepth = z.Indepth };
         info.SectionInfo = "Indepth Inquiries";
         info.Result = Indepth.Count();
         QuarterlyInfo.Add(info);

  var general = from z in ctx.Interactions
         where z.ActivityDate >= start && z.ActivityDate <= end && z.Indepth == false
         select new { Indepth = z.Indepth };
         info.SectionInfo = "General Inquiries";
         info.Result = general.Count();
         QuarterlyInfo.Add(info);                
        }

1 个答案:

答案 0 :(得分:0)

不确定信息对象是什么,但您要在两个查询中添加它:

     info.SectionInfo = "Indepth Inquiries";
     info.Result = Indepth.Count();
     QuarterlyInfo.Add(info);

     info.SectionInfo = "Indepth Inquiries";
     info.Result = Indepth.Count();
     QuarterlyInfo.Add(info);

可能是骗局的原因?