You can read or write to a file or stream using the IXmlSerializable interface.
The following code writes to a file.
C# |
Copy Code
|
---|---|
FarPoint.Win.Chart.ChartModel model = chart.Model; System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(@"c:\temp\test.xml", null); model.WriteXml(writer); writer.Close(); |
Visual Basic |
Copy Code
|
---|---|
Dim model As FarPoint.Win.Chart.ChartModel = chart.Model Dim writer As New System.Xml.XmlTextWriter("c:\temp\test.xml", Nothing) model.WriteXml(writer) writer.Close() |
The following code reads from a file.
C# |
Copy Code
|
---|---|
FarPoint.Win.Chart.ChartModel model = chart.Model; System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(@"c:\temp\test.xml"); model.ReadXml(reader); reader.Close(); |
Visual Basic |
Copy Code
|
---|---|
Dim model As FarPoint.Win.Chart.ChartModel = Chart.Model Dim reader As New System.Xml.XmlTextReader("c:\temp\test.xml") model.ReadXml(reader) reader.Close() |