IFeatureLayer vs IFeatureLayer2

742
2
Jump to solution
10-22-2012 07:05 AM
Highlighted
New Contributor III
The help mentions that IFeatureLayer2 supersedes IFeatureLayer. Does that mean eventually IFeatureLayer will be deprecated? Or is it OK to continue using IFeatureLayer even for new work and only IFeatureLayer2 if I need its extra methods?
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Regular Contributor II
Deprecating interfaces breaks the COM contract so it will probably be there for the foreseeable future.  The only time I saw esri deprecate interfaces is when they deprecated the class too.  if you look at the classes that implement IFeatureLayer2 and compare to the classes that implement IFeatureLayer, you will notice not all classes the implement IFeatureLayer, implement IFeatureLayer2, so for those you have no choice.  ArcObjects is littered with 2, 3, 4... interfaces for the precise reason that COM forbids modifying a published interface so if you have a compelling reason to use IFeatureLayer (maybe the method you want to use returns IFeatureLayer or takes it in,) then you are fine.

View solution in original post

Reply
0 Kudos
2 Replies
Highlighted
Regular Contributor II
Deprecating interfaces breaks the COM contract so it will probably be there for the foreseeable future.  The only time I saw esri deprecate interfaces is when they deprecated the class too.  if you look at the classes that implement IFeatureLayer2 and compare to the classes that implement IFeatureLayer, you will notice not all classes the implement IFeatureLayer, implement IFeatureLayer2, so for those you have no choice.  ArcObjects is littered with 2, 3, 4... interfaces for the precise reason that COM forbids modifying a published interface so if you have a compelling reason to use IFeatureLayer (maybe the method you want to use returns IFeatureLayer or takes it in,) then you are fine.

View solution in original post

Reply
0 Kudos
Highlighted
New Contributor III
Deprecating interfaces breaks the COM contract so it will probably be there for the foreseeable future.  The only time I saw esri deprecate interfaces is when they deprecated the class too.  if you look at the classes that implement IFeatureLayer2 and compare to the classes that implement IFeatureLayer, you will notice not all classes the implement IFeatureLayer, implement IFeatureLayer2, so for those you have no choice.  ArcObjects is littered with 2, 3, 4... interfaces for the precise reason that COM forbids modifying a published interface so if you have a compelling reason to use IFeatureLayer (maybe the method you want to use returns IFeatureLayer or takes it in,) then you are fine.


Thanks for the response! It also appears IFeatureLayer2 does not contain everything IFeatureLayer has so its doesn't appear to be a replacement even though they say it supercedes it.
Reply
0 Kudos