private ManualTypeDescriberBuilder(ManualTypeDescriber other) { FallbackBehavior = other.ThrowsOnNoConfiguredType ? ManualTypeDescriberFallbackBehavior.Throw : ManualTypeDescriberFallbackBehavior.UseFallback; FallbackTypeDescriber = other.Fallback; Builders = ImmutableDictionary.CreateBuilder <TypeInfo, InstanceProvider>(); foreach (var b in other.Builders) { Builders[b.Key] = b.Value; } Serializers = new Dictionary <TypeInfo, ImmutableArray <SerializableMember> .Builder>(); foreach (var s in other.Serializers) { var arr = ImmutableArray.CreateBuilder <SerializableMember>(); arr.AddRange(s.Value); Serializers[s.Key] = arr; } Deserializers = new Dictionary <TypeInfo, ImmutableArray <DeserializableMember> .Builder>(); foreach (var s in other.Deserializers) { var arr = ImmutableArray.CreateBuilder <DeserializableMember>(); arr.AddRange(s.Value); Deserializers[s.Key] = arr; } }
/// <summary> /// Create a new ManualTypeDescriberBuilder that copies it's /// initial values from the given ManualTypeDescriber. /// </summary> public static ManualTypeDescriberBuilder CreateBuilder(ManualTypeDescriber typeDescriber) { Utils.CheckArgumentNull(typeDescriber, nameof(typeDescriber)); return(new ManualTypeDescriberBuilder(typeDescriber)); }