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

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