Catel.Data.PropertyDataManager.MapPropertyNameToXmlAttributeName C# (CSharp) Метод

MapPropertyNameToXmlAttributeName() публичный Метод

Maps the name of the property name to an XML attribute name.
public MapPropertyNameToXmlAttributeName ( Type type, string propertyName ) : string
type System.Type The type for which to make the xml name.
propertyName string Name of the property.
Результат string
        public string MapPropertyNameToXmlAttributeName(Type type, string propertyName)
        {
            return _xmlAttributeMappings.MapPropertyNameToXmlName(type, propertyName);
        }

Usage Example

Пример #1
0
        /// <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());
            }
        }