Ejemplo n.º 1
0
 /// <inheritdoc/>
 public override ImmutableSortedSet <T> ConvertFromSurrogate(ref ImmutableSortedSetSurrogate <T> surrogate)
 {
     if (surrogate.Values is null)
     {
         return(null);
     }
     else
     {
         if (surrogate.KeyComparer is object)
         {
             return(ImmutableSortedSet.CreateRange(surrogate.KeyComparer, surrogate.Values));
         }
         else
         {
             return(ImmutableSortedSet.CreateRange(surrogate.Values));
         }
     }
 }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public override void ConvertToSurrogate(ImmutableSortedSet <T> value, ref ImmutableSortedSetSurrogate <T> surrogate)
        {
            if (value is null)
            {
                surrogate = default;
                return;
            }
            else
            {
                surrogate = new ImmutableSortedSetSurrogate <T>
                {
                    Values = new List <T>(value)
                };

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