protected void SetFlag(TestPropertyFlags flags, bool value) { if (value) { pflags |= flags; } else { pflags &= ~flags; } }
protected void AddProperty(XElement element, string name, object value, TestPropertyFlags flags) { //Ignore all the properties that have no name or value (as to not bloat the xml) if (name == null || value == null) { return; } //How to serialize (elements or attributes) if ((flags & TestPropertyFlags.MultipleValues) != 0) { AddValue(element, name, value); } else { element.SetAttributeValue(name, StringEx.ToString(value)); } }
protected void SetFlag(TestPropertyFlags flags, bool value) { if (value) pflags |= flags; else pflags &= ~flags; }
//Helpers protected bool IsFlag(TestPropertyFlags flags) { return (pflags & flags) == flags; }
//Helpers protected bool IsFlag(TestPropertyFlags flags) { return((pflags & flags) == flags); }
protected void AddProperty(XElement element, string name, object value, TestPropertyFlags flags) { //Ignore all the properties that have no name or value (as to not bloat the xml) if (name == null || value == null) return; //How to serialize (elements or attributes) if ((flags & TestPropertyFlags.MultipleValues) != 0) { AddValue(element, name, value); } else { element.SetAttributeValue(name, StringEx.ToString(value)); } }
protected void AddProperty(XmlNode element, string name, object value, TestPropertyFlags flags) { //Ignore all the properties that have no name or value (as to not bloat the xml) if(name == null || value == null) return; //How to serialize (elements or attributes) if((flags & TestPropertyFlags.MultipleValues) != 0) { //Property as Element AddValue(element, name, value); } else { //Property as Attribute XmlAttribute xmlattribute = _xmldoc.CreateAttribute(name); xmlattribute.Value = StringEx.ToString(value); element.Attributes.Append( xmlattribute ); } }
protected void AddProperty(XmlNode element, string name, object value, TestPropertyFlags flags) { //Ignore all the properties that have no name or value (as to not bloat the xml) if (name == null || value == null) { return; } //How to serialize (elements or attributes) if ((flags & TestPropertyFlags.MultipleValues) != 0) { //Property as Element AddValue(element, name, value); } else { //Property as Attribute XmlAttribute xmlattribute = _xmldoc.CreateAttribute(name); xmlattribute.Value = StringEx.ToString(value); element.Attributes.Append(xmlattribute); } }