Cysharp / ObservableCollections

High performance observable collections and synchronized views, for WPF, Blazor, Unity.
MIT License
602 stars 46 forks source link

Add constructors for ObservableDictionary and ObservableHashSet #60

Closed prozolic closed 3 months ago

prozolic commented 3 months ago

I have added the following constructors to ObservableDictionary and ObservableHashSet. It might be beneficial when the initial capacity is known in advance or when you want to use a specified equality comparer. I think it is also related to Issue #59

public ObservableDictionary(int capacity);
public ObservableDictionary(IEqualityComparer<TKey>? comparer);
public ObservableDictionary(int capacity, IEqualityComparer<TKey>? comparer);
public ObservableDictionary(IEnumerable<KeyValuePair<TKey, TValue>> collection, IEqualityComparer<TKey>? comparer);

public ObservableHashSet(IEqualityComparer<T>? comparer);
public ObservableHashSet(int capacity, IEqualityComparer<T>? comparer);
public ObservableHashSet(IEnumerable<T> collection, IEqualityComparer<T>? comparer);
neuecc commented 3 months ago

thanks, but it is almostly same as https://github.com/Cysharp/ObservableCollections/pull/55

prozolic commented 3 months ago

It was indeed the same. I am sorry for not confirming sufficiently.