IWorkspaceDomains2 workspaceDomains = (IWorkspaceDomains2)workspace; IDomain requestedDomain = workspaceDomains.get_DomainByName(domainName);
IList<string> domainNameList = new List<string>(); IDomain domain = workspaceDomains.Domains.Next(); while (domain != null) { domainNameList.Add(domain.Name); domain = workspaceDomains.Domains.Next(); }
Solved! Go to Solution.
IEnumDomain allDomains = workspaceDomains.Domains; IDomain domain = allDomains.Next(); //now loop through allDomains
IEnumDomain allDomains = workspaceDomains.Domains; IDomain domain = allDomains.Next(); //now loop through allDomains
Hi Simon,
I checked with someone who uses the gdb api all the time and it looks like IWorkspaceDomains2.Domains pulls all the domains so IWorkspaceDomains2.Domains.Next will always be the first one. He suggested to put the enumeration of domains in another variable and then loop through that.
For example something like:IEnumDomain allDomains = workspaceDomains.Domains; IDomain domain = allDomains.Next(); //now loop through allDomains
You could also pull the domain list using SQL. There is a topic and examples in the doc:
10.1 Help - Browsing geodatabase system tables with SQL
10.1 Help - Example: Finding domain owners using SQL
Hope this helps.