Skip to content

CollectionChangedArgsExtensions Class

C#
public static class CollectionChangedArgsExtensions

Inheritance object

ToNotifyCollectionChangedEventArgs(CollectionChangedArgs)

Section titled “ToNotifyCollectionChangedEventArgs(CollectionChangedArgs)”

Converts the CollectionChangedArgs<T> to a NotifyCollectionChangedEventArgs.

C#
public static NotifyCollectionChangedEventArgs ToNotifyCollectionChangedEventArgs<T>(this CollectionChangedArgs<T> args)

args CollectionChangedArgs<T>
The current args.

NotifyCollectionChangedEventArgs
The converted NotifyCollectionChangedEventArgs.

NotSupportedException
args.Action is not supported.

TryGetNewValue<TKey, TValue>(CollectionChangedArgs<KeyValuePair<TKey, TValue>>, TKey, out TValue?)

Section titled “TryGetNewValue<TKey, TValue>(CollectionChangedArgs<KeyValuePair<TKey, TValue>>, TKey, out TValue?)”

Helper method to get a value from the NewItems based on the given key.

C#
public static bool TryGetNewValue<TKey, TValue>(this CollectionChangedArgs<KeyValuePair<TKey, TValue>> args, TKey key, out TValue? value)

args CollectionChangedArgs<KeyValuePair<TKey, TValue>>
The current args.

key TKey
The key to find the value for.

value TValue
The found value, if any.

bool
true if a value was found; otherwise false.

TryGetOldValue<TKey, TValue>(CollectionChangedArgs<KeyValuePair<TKey, TValue>>, TKey, out TValue?)

Section titled “TryGetOldValue<TKey, TValue>(CollectionChangedArgs<KeyValuePair<TKey, TValue>>, TKey, out TValue?)”

Helper method to get a value from the OldItems based on the given key.

C#
public static bool TryGetOldValue<TKey, TValue>(this CollectionChangedArgs<KeyValuePair<TKey, TValue>> args, TKey key, out TValue? value)

args CollectionChangedArgs<KeyValuePair<TKey, TValue>>
The current args.

key TKey
The key to find the value for.

value TValue
The found value, if any.

bool
true if a value was found; otherwise false.