Public Static BOOLSample (list<string>Inrasters,stringLocationdata,stringOuttable,stringResamplingtype,stringoutexcel) {geoprocessor GP=Newgeoprocessor (); Gp. Overwriteoutput=true; stringISTR = inrasters[0]; for(intj =1; J < Inrasters.count (); J + +) {ISTR+=";"+Inrasters[j]; } ESRI. ArcGIS.SpatialAnalystTools.Sample Sam=NewESRI. ArcGIS.SpatialAnalystTools.Sample (); Sam.in_rasters= ISTR;//inrasters;Sam.in_location_data =Locationdata; Sam.out_table=outtable; Sam.resampling_type=Resamplingtype; Try{GP. Execute (Sam,NULL); } Catch(COMException e) {stringstr =""; for(inti =0; I < GP. Messagecount; i++) {str+=GP. GetMessage (i); } MessageBox.Show (str); return false; } if(!excelutil.createexcelbyitable (Outtable,outexcel)) {MessageBox.Show ("failed to build Excel table! "); return false; } return true; }
C # arcengine Print out an error in GP call error