AnsweredAssumed Answered

List Fields In Feature In Pro SDK

Question asked by mapvis01 on Jan 14, 2019
Latest reply on Jan 16, 2019 by mapvis01

I am trying to get a list of the fields in a feature inside the project default geodatabase.

what is the c# pro sdk equivalent of the python below?


for lyr in m.listLayers():
            if == "layer":
                field_names = []
                fields = arcpy.ListFields(lyr)
                for field in fields:


Do i have to go through the geodatabse API with a feature definition to get that list? like below. or is there a shorter or more prefered way?


using (Geodatabase fileGeodatabase = new Geodatabase(new FileGeodatabaseConnectionPath((uri))))

using (FeatureClass featureClass = fileGeodatabase.OpenDataset<FeatureClass>(matchLyr))


   FeatureClassDefinition LyrDefinition = featureClass.GetDefinition();

   IReadOnlyList<Field> fields = LyrDefinition.GetFields();

   List<string> fieldList = new List<string>();

   foreach (var fld in fields)





   return fieldList;