Cysharp / ObservableCollections

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

Add constructors for ObservableDictionary and ObservableHashSet #60

Closed prozolic closed 1 month ago

prozolic commented 1 month 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 1 month ago

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

prozolic commented 1 month ago

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