public static IEnumerable <T> GetUniqueColumnValues <T>(ICursor cursor, string columnName) { IDataStatistics dataStatistics = null; try { //获取null值 T nullValue = default(T); dataStatistics = new DataStatisticsClass(); dataStatistics.Cursor = cursor; dataStatistics.Field = columnName; IEnumerator enumerator = dataStatistics.UniqueValues; enumerator.Reset(); while (enumerator.MoveNext()) { object currValue = enumerator.Current; if (currValue == DBNull.Value || currValue == null) { yield return(nullValue); } else { yield return((T)Convert.ChangeType(currValue, typeof(T))); } } } finally { AOUtil.ReleaseComObjectAllRefs(dataStatistics); } }
public override void OnClick() { ILayer pLayer = (ILayer)_mapControl.CustomProperty; if (pLayer is IGroupLayer) { //获取GroupLayer中的图层 var subLayers = LayerUtil.GetFeatureLayersFromGroupLayer(pLayer as IGroupLayer); foreach (var subLayer in subLayers) { _mapControl.Map.DeleteLayer(subLayer); AOUtil.ReleaseComObjectAllRefs(subLayer); } } _mapControl.Map.DeleteLayer(pLayer); _mapControl.ActiveView.Refresh(); AOUtil.ReleaseComObjectAllRefs(pLayer); }
public override void OnClick() { _mapControl.Map.ClearLayers(); AOUtil.ReleaseComObjectAllRefs(_mapControl.Map.Layers); _mapControl.ActiveView.Refresh(); }