private DatasetVector DatasetConvertRegionToLine(DatasetVector dtVector2) { DatasetVector dtVector = null; if (dtVector2 != null) { DatasetVectorInfo dvi = new DatasetVectorInfo(); dvi.Name = m_selLayer.Dataset.Datasource.Datasets.GetAvailableDatasetName("C_geoLine"); dvi.Type = DatasetType.Line; //DatasetVector dtVector = m_selLayer.Dataset.Datasource.Datasets.Create(dvi); foreach (FieldInfo fi in dtVector2.FieldInfos) { if (dtVector.FieldInfos.IndexOf(fi.Name) < 0 && !fi.IsSystemField) { dtVector.FieldInfos.Add(fi.Clone()); } } Recordset recdst = dtVector.GetRecordset(true, CursorType.Dynamic); recdst.Batch.Begin(); try { Recordset recdst2 = dtVector2.GetRecordset(false, CursorType.Static); while (!recdst2.IsEOF) { GeoRegion geoR = recdst2.GetGeometry() as GeoRegion; if (geoR != null) { GeoLine geoLine = geoR.ConvertToLine(); recdst.AddNew(geoLine); foreach (FieldInfo fi in dtVector2.FieldInfos) { if (dtVector.FieldInfos.IndexOf(fi.Name) > -1 && !fi.IsSystemField) { recdst.SetFieldValue(fi.Name, recdst2.GetFieldValue(fi.Name)); } } geoR.Dispose(); } recdst2.MoveNext(); } recdst2.Dispose(); } catch { } recdst.Batch.Update(); recdst.Dispose(); } return(dtVector); }