private void ReadElementFromProperty(XmlReader reader, object obj, XmlSerializationContext context, IPropertySerializationInfo p)
{
var href = reader.GetAttribute("href");
if (href == null)
{
if (p.PropertyType.IsStringConvertible || (p.PropertyType.IsCollection && p.PropertyType.CollectionItemType.IsStringConvertible))
{
string content = reader.ReadElementContentAsString();
if (p.PropertyType.IsCollection)
{
p.AddToCollection(obj, p.PropertyType.CollectionItemType.ConvertFromString(content), context);
}
else
{
p.SetValue(obj, p.ConvertFromString(content), context);
}
}
else
{
object current = DeserializeInternal(reader, p, context);
if (p.PropertyType.IsCollection)
{
p.AddToCollection(obj, current, context);
}
else
{
p.SetValue(obj, current, context);
}
}
}
else
{
if (p.PropertyType.IsCollection)
{
EnqueueAddToPropertyDelay(p, obj, href, context);
}
else
{
EnqueueSetPropertyDelay(p, obj, href, context);
}
}
}