1 /**//// <summary>
2 /// 得到要素類某欄位的
唯一值
3 /// </summary>
4 /// <param name="pFeatureClass">要素類</param>
5 /// <param name="strFld">指定要得到
唯一值的欄位</param>
6 /// <returns>唯一值字元資料</returns>
7 public static string[] GetUniqueValue(IFeatureClass pFeatureClass,string strFld)
8 {
9 //得到IFeatureCursor遊標
10 IFeatureCursor pCursor=pFeatureClass.Search(null,false);
11
12 //coClass對象執行個體產生
13 IDataStatistics pData=new DataStatisticsClass();
14 pData.Field=strFld;
15 pData.Cursor=pCursor as ICursor;
16
17 //枚舉
唯一值
18 IEnumerator pEnumVar=pData.UniqueValues ;
19
20 //記錄總數
21 int RecordCount=pData.UniqueValueCount;
22
23 //字元數組
24 string[] strValue=new string[RecordCount];
25 pEnumVar.Reset();
26
27 int i=0;
28
29 while(pEnumVar.MoveNext())
30 {
31 strValue[++i]=pEnumVar.Current.ToString();
32 }
33
34 return strValue;
35 }
http://www.cnblogs.com/3echo/archive/2006/08/16/478094.html