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

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

Determines whether the specified property is mapped to an XML attribute.
The is null. The is null or whitespace.
public IsPropertyNameMappedToXmlAttribute ( Type type, string propertyName ) : bool
type System.Type The type.
propertyName string Name of the property.
Результат bool
        public bool IsPropertyNameMappedToXmlAttribute(Type type, string propertyName)
        {
            return _xmlAttributeMappings.IsPropertyNameMappedToXmlName(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());
            }
        }