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.
Let me answer my own question ;-))
A typed DataSet is simply a class you can instantiate like any other class.
There is no magic to anything generated by tools, those tools simply generate classes and you can use those classes the same way you use other classes.
Do
NewDataSet d1 = new NewDataSet();where you put the right class name there instead of “NewDataSet”.