AnsweredAssumed Answered

Different between IField and IFields

Question asked by justinzhou on Aug 21, 2018
Latest reply on Aug 21, 2018 by

As a beginner, I am just so confused with IField, IFieldEdit, IFields, IFieldsEdit.

Grateful that someone can help this so I can understand it in a logical way.


Sub Question 1: What are the relations among them? And what can be the easier way to understand their purpose after their instance creation?


Sub Question 2: How to understand the following coding?


// I guess both pFields and pField use FieldsClass() to create an instance


IFields   pFields = new FieldsClass();

IField    pField = new FieldClass();


// Can I comprehend in this way that pFieldsEdit and pFieldEdit are created to "inherit" members and methods of pFields and pField, respectively? 


IFieldsEdit  pFieldsEdit = (IFieldsEdit)pFields;
IFieldEdit    pFieldEdit = (IFieldEdit)pField;


// Some value assignment on pFieldEdit

pFieldEdit.Name_2 = "Shape";
pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;


// ....  some code here ....code related to IField or IFields are shown here....


pFieldEdit.GeometryDef_2 = pGeometryDef;


// The above code shows nothing to do with pField, but what happened to pField after operations on pFieldEdit ?

IFeatureClass pFeatureClass;
pFeatureClass = pFWS.CreateFeatureClass(shapeName, pFields, null, null, esriFeatureType.esriFTSimple, "Shape", "");