查看IfeatureLayer的Search方法的帮助,如下:
If there is a definition query set on the layer, the Search method will work on the subset of features in the layer that meet the definition criteria. Otherwise, it will search the FeatureClass associated with the layer.
This Search method will not work on joined fields. If the FeaureLayer has any joins, you should use the IGeoFeatureLayer::SeachDisplayFeatures method instead.
值得注意的是,如果图层没有设置definition query ,那么两者的结果没有差别,但是如果图层设置了definition query ,那么就有差别了,呵呵。
也就是说,在开发过程中,如果是针对图层数据的操作,那么用IfeatureLayer的Search比较合理,如果是针对图层对应的数据源的操作,那么使用IfeatureClass的search才能保证所有的数据被遍历。