C# 新的ObservableCollection与在循环中添加项
就速度和生成的通知量而言,以下代码是:C# 新的ObservableCollection与在循环中添加项,c#,silverlight,telerik,observablecollection,radchart,C#,Silverlight,Telerik,Observablecollection,Radchart,就速度和生成的通知量而言,以下代码是: ObservableCollection<Foo> foo = new ObservableCollection<Foo>(bar); this.SomeProperty = foo; observetecollection foo=新的observetecollection(bar); this.SomeProperty=foo; 同: this.SomeProperty = new ObservableCollection&
ObservableCollection<Foo> foo = new ObservableCollection<Foo>(bar);
this.SomeProperty = foo;
observetecollection foo=新的observetecollection(bar);
this.SomeProperty=foo;
同:
this.SomeProperty = new ObservableCollection<Foo>();
foreach (var v in bar)
{
this.SomeProperty.Add(v);
}
this.SomeProperty=newObservableCollection();
foreach(以巴为单位的v值)
{
这个.SomeProperty.Add(v);
}
如果它们相同,是否可以以某种方式关闭生成的通知
目标:
我正在努力加快silverlight中Telerik RadChart的显示速度。即使在设置了包含ObservableCollection的属性之后,显示(并冻结浏览器中的应用程序)似乎也需要一些时间。一旦绘制出图表,一切正常
如果冻结是在绑定实际发生之前发生的,那么我会确保延迟不是基于渲染的,也不是因为另一个活动(比如加载集合所花费的时间)。同样,评测是您的朋友。在构造函数期间不会触发该事件,因为事先无法订阅它(因此触发它是无用的,因为肯定没有侦听器)。