/// <summary>
/// Writes the XML attributes to the xml writer.
/// </summary>
/// <param name="writer">The writer.</param>
/// <param name="type">The type.</param>
private void WriteXmlAttributes(XmlWriter writer, Type type)
{
IEnumerable <KeyValuePair <string, object> > propertiesAsAttributes;
lock (_propertyValuesLock)
{
propertiesAsAttributes = (from propertyValue in _propertyBag.GetAllProperties()
where PropertyDataManager.IsPropertyNameMappedToXmlAttribute(type, propertyValue.Key)
select propertyValue);
}
foreach (var propertyAsAttribute in propertiesAsAttributes)
{
var attributeName = PropertyDataManager.MapPropertyNameToXmlAttributeName(type, propertyAsAttribute.Key);
writer.WriteAttributeString(attributeName, propertyAsAttribute.Value.ToString());
}
}