[reflection] Coop handles icalls in System.Reflection and System.RuntimeTypeHandle...
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Base / Core / Internal / PropertyEditing / FromExpression / Framework / Data / ObservableCollection.cs
1 // -------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All Rights Reserved.
3 // -------------------------------------------------------------------
4 //From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data
5 namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data
6 {
7     using System;
8     using System.Collections;
9     using System.Collections.Generic;
10     using System.Collections.ObjectModel;
11     using System.Collections.Specialized;
12     using System.ComponentModel;
13     using System.Windows;
14
15     // <summary>
16     // Workaround for ObservableCollection not supporting IComparers.  The implementation was copied from ObservableCollection.
17     // </summary>
18     // <typeparam name="T"></typeparam>
19     internal sealed class ObservableCollectionWorkaround<T> : ObservableCollection<T>
20     {
21         public ObservableCollectionWorkaround()
22         {
23         }
24
25         public ObservableCollectionWorkaround(List<T> list)
26             : base(list)
27         {
28         }
29
30         public ObservableCollectionWorkaround(ICollection collection)
31         {
32             foreach (T item in collection)
33             {
34                 this.Add(item);
35             }
36         }
37
38         public int BinarySearch(T value, IComparer<T> comparer)
39         {
40             return ((List<T>)base.Items).BinarySearch(value, comparer);
41         }
42
43         public void Sort()
44         {
45             ((List<T>)base.Items).Sort();
46             this.OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
47             this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, null, -1));
48         }
49
50         public void Sort(IComparer<T> comparer)
51         {
52             ((List<T>)base.Items).Sort(comparer);
53             this.OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
54             this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, null, -1));
55         }
56
57         public void Sort(Comparison<T> comparison)
58         {
59             ((List<T>)base.Items).Sort(comparison);
60             this.OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
61             this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, null, -1));
62         }
63
64         public void Reverse()
65         {
66             ((List<T>)base.Items).Reverse();
67         }
68
69     }
70 }