private static void SetExtProperties(object instance, XmlAttributeCollection attrs)
{
PropertyCollection props = null;
for (int i = 0; i < attrs.Count; i++)
{
if (attrs[i].NamespaceURI == Keywords.MSPROPNS)
{
if (props == null)
{
object val = TypeDescriptor.GetProperties(instance)["ExtendedProperties"].GetValue(instance);
Debug.Assert(val is PropertyCollection, "We can set values only for classes that have ExtendedProperties");
props = (PropertyCollection)val;
}
string propName = XmlConvert.DecodeName(attrs[i].LocalName);
props.Add(propName, attrs[i].Value);
}
}
}// SetExtProperties