Hello
Everyone
I have a problem to get the subtypes from tables in arcmap with the arcobjects library in C# (sharp) lenguage.
So i need that someone could help me with some code example.
Appreciating the attention
You Can Use the Following Code (C#) -
//here item is a IfeatureClass
ISubtypes subtypes = item as ISubtypes;if (subtypes.HasSubtype){IEnumSubtype enumSubtype = subtypes.Subtypes;enumSubtype.Reset();int subcode = -1;string subdesc = enumSubtype.Next(out subcode);while (!string.IsNullOrEmpty(subdesc)){subdesc = enumSubtype.Next(out subcode);
//str3 is a string (empty)str3 = subdesc;
}
//in this above code you can able to find subtype names associated with each featurelayer
<CODE><SPAN class="" style="color: #0000ff;">public</SPAN> <SPAN class="" style="color: #0000ff;">void</SPAN> GetSubtypes(IFeatureClass featureClass) { <SPAN class="" style="color: #008000;">// Cast the feature class to the ISubtypes interface.</SPAN> ISubtypes subtypes = (ISubtypes)featureClass; <SPAN class="" style="color: #008000;">// then you can enumeraate subtypes.</SPAN> IEnumSubtype enumSubtype = subtypes.Subtypes }
Have a look at this page on the API help file, whilst it's about creating subtypes you should be able to figure out how to access existing subtypes.
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.