C # + ae9.1 obtain the unique value of a field

Source: Internet
Author: User
1/** // <summary>
2 // obtain Unique value
3 /// </Summary>
4 /// <Param name = "pfeatureclass"> element class </param>
5 // <Param name = "strfound"> specify Unique value </Param>
6 /// <returns> unique value character data </returns>
7 public static string [] getuniquevalue (ifeatureclass pfeatureclass, string strue)
8 {
9 // obtain the ifeaturecursor cursor
10 ifeaturecursor pcursor = pfeatureclass. Search (null, false );
11
12 // coclass object instance generation
13 idatastatistics pdata = new datastatisticsclass ();
14 pdata. Field = strdata;
15 pdata. cursor = pcursor as icursor;
16
17 // Enumeration Unique value
18 ienumerator penumvar = pdata. uniquevalues;
19
20 // total number of records
21 int recordcount = pdata. uniquevaluecount;
22
23 // character array
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.