by Codewiz51
3. September 2008 21:32
I spent the day calling potential clients in various public agencies, trying to establish some contacts. I like this part of my work. I enjoy selling Southwest Research Institute services and capabilities. Our organization has a lot of resources that enable us to carry out a lot of practical/applied R & D work.
I also spent some time honing my skills in class serialization techniques using C#. I ran into a gotcha, otherwise this would be a really boring blog entry. This is a code fragment from the XMLAttributeOverrides documentation that I was experimenting on:
/* Create an XmlElementAttribute to override the
field that returns Instrument objects. The overridden field
returns Brass objects instead. */
XmlElementAttribute attr = new XmlElementAttribute();
attr.ElementName = "Brass";
attr.Type = typeof(Brass);
// Add the element to the collection of elements.
attrs.XmlElements.Add(attr);
// Create the XmlAttributeOverrides object.
XmlAttributeOverrides attrOverrides = new XmlAttributeOverrides();
/* Add the type of the class that contains the overridden
member and the XmlAttributes to override it with to the
XmlAttributeOverrides object. */
attrOverrides.Add(typeof(Orchestra), "Instruments", attrs);
More...