Skip to content

Commit d909466

Browse files
author
Paul Betts
committed
Merge pull request #498 from reactiveui/fix-for-485
Make non-generic IList implementation explicit and pull a few public Rea...
2 parents be7fbc9 + 430fe72 commit d909466

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

ReactiveUI/Interfaces.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ public interface IReactiveNotifyCollectionChanged : INotifyCollectionChanged
285285
/// Doing It Wrong.
286286
/// </summary>
287287
IObservable<Unit> ShouldReset { get; }
288+
289+
IDisposable SuppressChangeNotifications();
288290
}
289291

290292
/// <summary>
@@ -338,6 +340,7 @@ public interface IReactiveNotifyCollectionChanged<out T> : IReactiveNotifyCollec
338340
/// </summary>
339341
public interface IReactiveCollection<out T> : IReactiveNotifyCollectionChanged<T>, IReactiveNotifyCollectionItemChanged<T>, IEnumerable<T>, INotifyPropertyChanging, INotifyPropertyChanged, IEnableLogger
340342
{
343+
void Reset();
341344
}
342345

343346
/// <summary>
@@ -386,6 +389,18 @@ public interface IReactiveDerivedList<T> : IReadOnlyReactiveList<T>, IDisposable
386389
/// </summary>
387390
public interface IReactiveList<T> : IReactiveCollection<T>, IList<T>
388391
{
392+
void AddRange(IEnumerable<T> collection);
393+
394+
void InsertRange(int index, IEnumerable<T> collection);
395+
void RemoveAll(IEnumerable<T> items);
396+
397+
void RemoveRange(int index, int count);
398+
399+
void Sort(IComparer<T> comparer = null);
400+
401+
void Sort(Comparison<T> comparison);
402+
403+
void Sort(int index, int count, IComparer<T> comparer);
389404
}
390405

391406
// NB: This is just a name we can bolt extension methods to
@@ -451,4 +466,4 @@ public class ViewContractAttribute : Attribute
451466
}
452467
}
453468

454-
// vim: tw=120 ts=4 sw=4 et :
469+
// vim: tw=120 ts=4 sw=4 et :

ReactiveUI/ReactiveList.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -711,30 +711,30 @@ public virtual T this[int index] {
711711
set { SetItem(index, value); }
712712
}
713713

714-
public int Add(object value)
714+
int IList.Add(object value)
715715
{
716716
Add((T)value);
717717
return Count - 1;
718718
}
719719

720-
public bool Contains(object value)
720+
bool IList.Contains(object value)
721721
{
722722
return IsCompatibleObject(value) && Contains((T)value);
723723
}
724724

725-
public int IndexOf(object value)
725+
int IList.IndexOf(object value)
726726
{
727727
return IsCompatibleObject(value) ? IndexOf((T)value) : -1;
728728
}
729729

730-
public void Insert(int index, object value)
730+
void IList.Insert(int index, object value)
731731
{
732732
Insert(index, (T)value);
733733
}
734734

735-
public bool IsFixedSize { get { return false; } }
735+
bool IList.IsFixedSize { get { return false; } }
736736

737-
public void Remove(object value)
737+
void IList.Remove(object value)
738738
{
739739
if (IsCompatibleObject(value)) Remove((T)value);
740740
}
@@ -745,14 +745,14 @@ object IList.this[int index]
745745
set { this[index] = (T)value; }
746746
}
747747

748-
public void CopyTo(Array array, int index)
748+
void ICollection.CopyTo(Array array, int index)
749749
{
750750
((IList)_inner).CopyTo(array, index);
751751
}
752752

753-
public bool IsSynchronized { get { return false; } }
753+
bool ICollection.IsSynchronized { get { return false; } }
754754

755-
public object SyncRoot { get { return this; } }
755+
object ICollection.SyncRoot { get { return this; } }
756756

757757
private static bool IsCompatibleObject(object value)
758758
{
@@ -768,7 +768,7 @@ public interface IMoveInfo<out T>
768768
int To { get; }
769769
}
770770

771-
public class MoveInfo<T> : IMoveInfo<T>
771+
internal class MoveInfo<T> : IMoveInfo<T>
772772
{
773773
public IEnumerable<T> MovedItems { get; protected set; }
774774
public int From { get; protected set; }

0 commit comments

Comments
 (0)