DictionaryExtensions

Name Value
Assembly Catel.Core
Namespace Catel.Collections
Available on .NET Framework 4.5, .NET Framework 4.6, Portable Class Libraries, Xamarin - Android, Xamarin - iOS
public static class DictionaryExtensions

Extensions for the class.

Methods

AddItemIfNotEmpty(Dictionary dictionary, TKey key, string value)

Adds the specified value using the key if the value is notnull or whitespace.

Type Parameters

TKey The type of the key.

Parameters

Name Description
dictionary The dictionary.
key The key.
value The value to check and to add.

Exceptions

Name Description
ArgumentNullException The dictionary isnull.

AddRange(Dictionary target, Dictionary source, bool overwriteExisting)

Adds all items from the source into the target dictionary.

Type Parameters

TKey The type of the key.

TValue The type of the value.

Parameters

Name Description
target The target.
source The source.
overwriteExisting if set totrue, existing items in the target dictionary will be overwritten.

Exceptions

Name Description
ArgumentNullException The target isnull.

Have a question about Catel? Use StackOverflow with the Catel tag!


Discussion