需释放:
IFeatureCursor
IFeature
IFeatureWorkspace
IFeatureClass
IWorkspace
不需要手动释放:
IGeoDataset
ISpatialFilter
IQueryFilter
补充:
这里注意的是,当我们使用查询一个图层中所有的要素进行遍历的时候,需要在遍历过程中对IFeature 进行释放,如:
IFeatureCursorpFeatureCursor = OutftClass.Search(null, true);
IFeature out_f = pFeatureCursor.NextFeature();
while(out_f!=null){
//代码
if (out_f != null) Marshal.FinalReleaseComObject(out_f);
out_f = pFeatureCursor.NextFeature();
}