/// <inheritdoc />
        public override SortedDictionary <TKey, TValue> ConvertFromSurrogate(ref SortedDictionarySurrogate <TKey, TValue> surrogate)
        {
            if (surrogate.Values is null)
            {
                return(null);
            }
            else
            {
                SortedDictionary <TKey, TValue> result;
                if (surrogate.Comparer is object)
                {
                    result = new SortedDictionary <TKey, TValue>(surrogate.Comparer);
                }
                else
                {
                    result = new SortedDictionary <TKey, TValue>();
                }

                foreach (var kvp in surrogate.Values)
                {
                    result.Add(kvp.Key, kvp.Value);
                }

                return(result);
            }
        }
        /// <inheritdoc />
        public override void ConvertToSurrogate(SortedDictionary <TKey, TValue> value, ref SortedDictionarySurrogate <TKey, TValue> surrogate)
        {
            if (value is null)
            {
                surrogate = default;
                return;
            }
            else
            {
                surrogate = new SortedDictionarySurrogate <TKey, TValue>
                {
                    Values = new List <KeyValuePair <TKey, TValue> >(value)
                };

                if (!ReferenceEquals(value.Comparer, Comparer <TKey> .Default))
                {
                    surrogate.Comparer = value.Comparer;
                }
            }
        }