Blog

Get Domain values of workspace using arcobject.

Posted by Yogesh Sharma Blogs | ArcObject Nov 20, 2012
Get Domain values of workspace using arcobject.
Get Domain values of workspace using arcobject.

            IWorkspaceFactory pworkspacefactory = new FileGDBWorkspaceFactoryClass();

            IWorkspace pworkspace = pworkspacefactory.OpenFromFile(@"C:\temp\temp1\Data.gdb", 0);

            IFeatureWorkspace pfeatureworkspace = pworkspace as IFeatureWorkspace;

            IWorkspaceDomains pwsDomain = pworkspace as IWorkspaceDomains;
            IEnumDomain penumdomain = pwsDomain.Domains;
            ICodedValueDomain pCodevalueDomain = null;
            IDomain pDomain= penumdomain.Next();
            Hashtable CodeVal = new Hashtable();
            
            
            while (pDomain != null)
            {
                pCodevalueDomain = pDomain as ICodedValueDomain;
                Hashtable codVal = new Hashtable();
                for (int i = 0; i < pCodevalueDomain.CodeCount; i++)
                {
                    codVal[pCodevalueDomain.get_Name(i)] = pCodevalueDomain.get_Value(i);
                }
                CodeVal[pDomain.Name] = codVal;
                pDomain = penumdomain.Next();
            }

COMMENT USING
PREMIUM SPONSORS
Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.