Exemplo 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 <T>(surrogate.KeyComparer, surrogate.Values));
         }
         else
         {
             return(ImmutableHashSet.CreateRange <T>(surrogate.Values));
         }
     }
 }
Exemplo 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, Comparer <T> .Default))
                {
                    surrogate.KeyComparer = value.KeyComparer;
                }
            }
        }