Exemple #1
0
        /****************************************************************************/
        public virtual void SerializeProperty(cXMLWriter objWriter, object objInstance, PropertyInfo objProperty)
        {
            if (m_eAttributes != Attributes.DeserializeOnly)
            {
                string strElementName = this.ElementName;

                if (strElementName == "")
                {
                    strElementName = objProperty.Name;
                }

                string strValue = objProperty.GetValue(objInstance, null).Normalized();

                if (m_bForceType)
                {
                    using (new XmlElementWriter(objWriter, strElementName))
                    {
                        objWriter.WriteAttributeString("type", objProperty.PropertyType.ToString().ToLower().Replace("system.", ""));
                        objWriter.WriteString(strValue);
                    }
                }
                else
                {
                    objWriter.WriteElementString(strElementName, strValue);
                }
            }
        }
Exemple #2
0
        /****************************************************************************/
        public override void SerializeProperty(cXMLWriter objWriter, object objInstance, PropertyInfo objProperty)
        {
            IEnumerable aList = objProperty.GetValue(objInstance, null) as IEnumerable;

            using (XmlElementWriter w = new XmlElementWriter(objWriter, "List"))
            {
                objWriter.WriteAttributeString("name", this.ElementName);

                SerializeList(objWriter, aList);
            }
        }
Exemple #3
0
        /****************************************************************************/
        public override void SerializeProperty(cXMLWriter objWriter, object objInstance, PropertyInfo objProperty)
        {
            if (m_eAttributes != Attributes.DeserializeOnly)
            {
                string strAttributeName = this.ElementName;

                if (strAttributeName == "")
                {
                    strAttributeName = objProperty.Name;
                }

                string strValue = objProperty.GetValue(objInstance, null).Normalized();

                objWriter.WriteAttributeString(strAttributeName, strValue);
            }
        }