Different between IField and IFields

386
1
08-21-2018 12:26 AM
JustinZHOU
New Contributor II

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 ?
pFieldsEdit.AddField(pField);

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

0 Kudos
1 Reply
nicogis
MVP Frequent Contributor

In general for understand the relation among them you can see Reading OMDs

You can access OMDs from the Help system's table of contents (TOC) by clicking the Namespace reference node, expanding the node for the applicable assembly, expanding the node for the proper namespace named node, then clicking the applicable <Namespace> Object Model Diagram node

for example for geodatabase : GeoDatabaseObjectModel