返回首页

嗨,

LINQ查询结果分配到DataGrid数据源,它需要大量的时间(40秒),我只在XML文件中有8000项(行​​)。我知道这是可以固定循环通过LINQ结果元素和添加一个网格视图,但有其他任何简单的方法,涉及到你的头脑?

提前感谢

var Log =

    from c in xmlDoc.Descendants("Event")

    select new

    {

        Type = ((string)c.Element("Type").Value),

        Class = ((string)c.Element("Class").Value),

        Method = ((string)c.Element("Method").Value),

        DateTime = ((string)c.Element("DateTime").Value),

        Text = ((string)c.Element("Text").Value),

        StackTrace = ((string)c.Element("StackTrace").Value),

        SourceTable = ((string)c.Element("SourceTable").Value),

        SourceField = ((string)c.Element("SourceField").Value),

        SourceValue = ((string)c.Element("SourceValue").Value),

        TargetTable = ((string)c.Element("TargetTable").Value)

    };

 

dbGridLog.AutoGenerateColumns = true;

dbGridLog.DataSource = Log.ToList();
| Mastersev

回答

评论会员: 时间:2