public void AddToCollection(object input, object item, XmlSerializationContext context)
 {
     if (!context.IsOppositeSet(input, this))
     {
         try
         {
             var collection = GetValue(input, context);
             PropertyType.AddToCollection(collection, item);
             context.BlockOpposite(item, this);
         }
         catch (InvalidCastException e)
         {
             throw new Exception($"The element {item} cannot be added to the property {ElementName} of {input} because the types do not match.", e);
         }
     }
 }
Esempio n. 2
0
 public override void OnResolveIdentifiedObject(object instance, XmlSerializationContext context)
 {
     Property.AddToCollection(Target, instance, context);
 }
Esempio n. 3
0
 public abstract void OnResolveIdentifiedObject(object instance, XmlSerializationContext context);
 public abstract void SetValue(object obj, object value, XmlSerializationContext context);
 public abstract object GetValue(object obj, XmlSerializationContext context);