This project is read-only.

Referencing DataTable before enumeration of features reduces execution enormously

Jun 28, 2015 at 8:13 AM
I discovered something that must be a bug in DotSpatial.
For a feature set with 400 000 line features, it takes 10 second to iterate over the features if featureSet.DataTable is referenced before the loop. If skipping that referencing, the execution times is 147 seconds, that is 15 times longer!
var fs = FeatureSet.OpenFile(fileName);
int nbFeatures = 0;
var dt = fs.DataTable; // SKIPPING this statement INCREASES execution time by factor 15!
foreach (var feature in fs.Features)
{
  nbFeatures += 1;
}
fs.Close();
Console.WriteLine(nbFeatures);