if (pEnvelopeFeedback != null)
{
// EnvelopeClass();
IEnvelope pEnvelope = new EnvelopeClass();
ISpatialFilter pSpatialFilter = new SpatialFilterClass();
pEnvelope = pEnvelopeFeedback.Stop();
pSpatialFilter.Geometry = pEnvelope;
pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;
pSpatialFilter.GeometryField = GeometryColumn;
ISelectionSet2 pselset;
IFeatureCursor pFeaturecursor;
pFeaturecursor = pFeatureClass.Search(pSpatialFilter, false);
int FeatureCount;
FeatureCount = pFeatureClass.FeatureCount(pSpatialFilter);
//MessageBox.Show(FeatureCount.ToString());
IFeature pFeature;
pFeature = pFeaturecursor.NextFeature();
I have a message about these implementations Ienvelope and ISpatialFilter for both the message said : interop type .....can not be embedded. Use the applicable interface instead??
I checked other implementation and this is the correct way to do it.
Solved! Go to Solution.
Open the Properties window of the Assembly and make sure to set Embed Interop Type to false on each of the ESRI references of your project.
Open the Properties window of the Assembly and make sure to set Embed Interop Type to false on each of the ESRI references of your project.
It did works, but why?
It has to do with a new change at .NET 4/4.5 that ESRI dll's do not need.
You can read more about it at the bottom of the following link (section called Using Embed Interop Types property on referenced assemblies):
http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#//000100000nzv000000
Thanks a lot Wayne.