AnsweredAssumed Answered

Where the values are stored when using interface?

Question asked by justinzhou on Aug 27, 2018

Now I am self-studying ArcObject development. It is noted using interface to create feature or files takes 80% of the code.

Grateful that someone can kindly tell where the values are stored when using interface?

Why don't we just create Field or Fields classes in the following example?



Dim pField As esriGeoDatabase.IField
Dim pFields As esriGeoDatabase.IFields

Dim pFieldEdit As esriGeoDatabase.IFieldEdit
Dim pFieldsEdit As esriGeoDatabase.IFieldsEdit


Set pFields = New esriGeoDatabase.Fields 
Set pFieldsEdit = pFields 
pFieldsEdit.FieldCount = 21 

Set pField = New esriGeoDatabase.Field 
Set pFieldEdit = pField 


' All the variables are of interface type without creating an instance of Field or Fields classes

' Why we don't just create Field or Fields classes?

With pFieldEdit
       .Name = "tempName"
       .Type = esriGeoDatabase.esriFieldTypeString
       .DefaultValue = Null ' Variant
       .Length = 10 

End With


' So the value of table metadata is stored in memory?
Set pFieldsEdit.Field(0) = pField