Select to view content in your preferred language

Displaying field names of a Feature Class

644
2
Jump to solution
11-09-2022 11:33 PM
ShanmugapriyaL1
New Contributor II

Hi,

I am new to this Arc Objects SDK platform.

I can able to get the feature class names from Geodatabase.

I want to display the field names of a feature class which is from Geodatabase.

Kindly anyone help me out in this. It will be more helpful if anyone has solution for this.

0 Kudos
1 Solution

Accepted Solutions
BrentHoskisson
Occasional Contributor III

The IFeatureClass object has a Fields property which is a collection of all the fields.  

You will need to iterate through each IField object in the IFields property.  Get the count from the IFields and set a for loop.  Get each IField object for each index and there is a Name object.

//fc is your featureclass object...

for(int i = 0; i < fc.Fields.FieldCount; i ++)
{
IField f = fc.Fields.get_Field(i);
string name = f.Name;   //collect these...
}

Brent

View solution in original post

0 Kudos
2 Replies
BrentHoskisson
Occasional Contributor III

The IFeatureClass object has a Fields property which is a collection of all the fields.  

You will need to iterate through each IField object in the IFields property.  Get the count from the IFields and set a for loop.  Get each IField object for each index and there is a Name object.

//fc is your featureclass object...

for(int i = 0; i < fc.Fields.FieldCount; i ++)
{
IField f = fc.Fields.get_Field(i);
string name = f.Name;   //collect these...
}

Brent

0 Kudos
ShanmugapriyaL1
New Contributor II

Thank you for your reply

0 Kudos