I use a DataGrid to show a xml file. The Grid's DataSource is a DataSet.(using schema)
Assembly assembly = Assembly.GetExecutingAssembly();
Stream stream = assembly.GetManifestResourceStream("XML_Reader.Resources.schema.xsd");
XmlSchemaSet schemas = new XmlSchemaSet();
XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.Schema;
settings.Schemas.Add(null, XmlReader.Create(stream));
using (XmlReader reader = XmlReader.Create(xmlFile, settings))
{
newDataSet.ReadXml(reader);
}
dataGrid.DataSource = newDataSet;
But when reading a new xml file, i need to clear the DataSet.(newDataSet.Clear();
)
Because i read 'large' (40 Mb) xml files, clearing the DataSet is very slow.
How can i speed up this clearing?
Reading the file is also slow !
On a: Intel i7 950, 8 Gb, Win7 64-bit.