/// <summary>
        /// Edits the value of the specified object using the specified service provider and context.
        /// </summary>
        /// <param name="context">An <see cref="ITypeDescriptorContext"/> that can be used to gain additional context information. </param>
        /// <param name="provider">A service provider object through which editing services can be obtained.</param>
        /// <param name="value">The object to edit the value of.</param>
        /// <returns>The new value of the object. If the value of the object has not changed, this should return the same object it was passed.</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (context.PropertyDescriptor != null &&
                context.PropertyDescriptor.Attributes[typeof(GenericDictionaryEditorAttribute)] is
                GenericDictionaryEditorAttribute attribute)
            {
                m_EditorAttribute = attribute;
                if (m_EditorAttribute.KeyDefaultProviderType == null)
                {
                    m_EditorAttribute.KeyDefaultProviderType = typeof(DefaultProvider <TKey>);
                }
                if (m_EditorAttribute.ValueDefaultProviderType == null)
                {
                    m_EditorAttribute.ValueDefaultProviderType = typeof(DefaultProvider <TValue>);
                }
            }
            else
            {
                m_EditorAttribute = new GenericDictionaryEditorAttribute
                {
                    KeyDefaultProviderType   = typeof(DefaultProvider <TKey>),
                    ValueDefaultProviderType = typeof(DefaultProvider <TValue>)
                };
            }

            return(base.EditValue(context, provider, value));
        }
 public EditableKeyValuePair(TKey key, TValue value, [NotNull] GenericDictionaryEditorAttribute editorAttribute)
 {
     Key             = key;
     Value           = value;
     EditorAttribute = editorAttribute ?? throw new ArgumentNullException(nameof(editorAttribute));
 }