public sealed class MyEnumBSTR : IEnumBSTR { private int _index = 0; private List<string> _strings = new List<string>(); private const int S_FALSE = 1; public void Add(string strVal) { _strings.Add(strVal); } public string Next() { if (_index < _strings.Count) { // return the string at the current index and // increment the index return _strings[_index++]; } // if we haven't returned a string, we are at the end of the list // we should be able to return null, but the ArcObjects API documentation is incorrect // a COM exception must be thrown to signal the end of the enumeration throw new COMException("Done", S_FALSE); } public void Reset() { _index = 0; } }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.