One thing you might not be aware of is that all the API classes are XML Serializable. This means that it’s very easy to convert on object to XML text and vice versa.
There many uses for this feature. For example…
- It can help you in debugging. If you have a large object with lots of data, it’s sometimes helpful to have an XML view of that object. Have a look at this example file of a LfCycDef object.
- If you are logging a case with ADN, you can include serialized objects as part of your problem description.
- Store information for later use. Just keep in mind that the class might change in the next release.
- Use it as a way to check if things have been changed. For example, you may write a program that requires a very specific lifecycle setup. You want your program to detect if somebody comes along and tampers with the settings. You can easily perform that check by serializing to XML.
Here is some sample code to go along with my last example.
private bool DidItChange(LfCycDef def)
using (TextWriter writer = new StringWriter(currentXML))
return (originalXML != currentXML.ToString()); }
private function DidItChange(def as LfCycDef ) as boolean
' now all you have to do is compare the two