Esempio n. 1
0
 /// <summary>
 /// Constructs a <see cref="TypeConvertBase"/> and copies the conversions from another <see cref="TypeConvertBase"/>.
 /// </summary>
 /// <param name="threadSafe">Determines if custom conversions use a <see cref="ConcurrentDictionary{TKey, TValue}"/>.</param>
 /// <param name="copyFrom">The <see cref="TypeConvertBase"/> to copy converters from.</param>
 public TypeConvertBase(bool threadSafe, TypeConvertBase copyFrom) : this(threadSafe)
 {
     if (copyFrom != null)
     {
         foreach (var kv in copyFrom.LookupCache)
         {
             LookupCache.Add(kv.Key, kv.Value);
         }
         for (int i = 2; i < 19; i++)
         {
             Func <object, object>[] arr     = converterArray[i];
             Func <object, object>[] copyArr = copyFrom.converterArray[i];
             for (int j = 0; j < 19; j++)
             {
                 arr[j] = copyArr[j];
             }
         }
     }
     else
     {
         for (int i = 2; i < 19; i++)
         {
             Func <object, object>[] arr = converterArray[i];
             for (int j = 0; j < 19; j++)
             {
                 arr[j] = InvalidConversion;
             }
             arr[i] = Conversions.None;
         }
         converterArray[17][17] = InvalidConversion;
     }
 }