<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                最近在優化WPF性能時, 發現在特定條件下BindingList比ObservableCollection性能更高, 因為它提供Disable/Enable 更改通知的方法。這樣我們可以不需要很頻繁的通知UI去更新, 而是等所有操作都做完后再通知。 然而, 默認的BindingList不支持Sort, 需要我們實現。 ~~~ public class SortableBindingList<T> : BindingList<T> { // Fields private bool isSorted; private ListSortDirection listSortDirection; private PropertyDescriptor propertyDescriptor; // Methods public SortableBindingList() { } public SortableBindingList(IList<T> list) : this() { base.Items.Clear(); foreach (T local in list) { base.Add(local); } } protected override void ApplySortCore(PropertyDescriptor prop, ListSortDirection direction) { (base.Items as List<T>).Sort(this.GetComparisionDelegate(prop, direction)); } private Comparison<T> GetComparisionDelegate(PropertyDescriptor propertyDescriptor, ListSortDirection direction) { return delegate(T t1, T t2) { int num2; ((SortableBindingList<T>)this).propertyDescriptor = propertyDescriptor; ((SortableBindingList<T>)this).listSortDirection = direction; ((SortableBindingList<T>)this).isSorted = true; int num = (direction == ListSortDirection.Ascending) ? 1 : -1; if (propertyDescriptor.PropertyType == typeof(string)) { num2 = StringComparer.CurrentCulture.Compare(propertyDescriptor.GetValue(t1), propertyDescriptor.GetValue(t2)); } else { num2 = Comparer.Default.Compare(propertyDescriptor.GetValue(t1), propertyDescriptor.GetValue(t2)); } return (num * num2); }; } protected override void RemoveSortCore() { this.isSorted = false; this.propertyDescriptor = base.SortPropertyCore; this.listSortDirection = base.SortDirectionCore; } // Properties protected override bool IsSortedCore { get { return this.isSorted; } } protected override ListSortDirection SortDirectionCore { get { return this.listSortDirection; } } protected override PropertyDescriptor SortPropertyCore { get { return this.propertyDescriptor; } } protected override bool SupportsSortingCore { get { return true; } } } ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ 調用RaiseListChangedEvents = false 或者RaiseListChangedEvents = true來控制更改通知, ~~~ ~~~ 調用ResetBindings()來全部更新, 或者ResetItem(index)來更新指定索引 ~~~ ~~~ ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看