I am new to ArcObjects, but I have managed to find and slightly modify some code that works perfectly for a task that I have ... with the exception that it is very, very slow (several minutes to run). The data I am using are not large, so I am guessing there is something within the code that is not quite maximized for speed. Attached is the code ... essentially it finds the Maximum Z value from a DEM layer using zonal stats with the zones being defined by ~150 polygons from a separate layer and then populates a field in that same polygon layer with those Z values. I am interested in learning the reason for the speed issue (to improve my skills) as much as I am interested in changing the code so any advice, explanations, and/or suggestions much appreciated. Thanks.
I've looked at your code and there appears to be some nutty situation where you are looping through every 5th vertex of each polygon and repeating the loop. I think this is where your code is going amiss. So I've cleaned up the code for you and have reposted it. You also create objects then never use them... I've removed them too! You placed code that only needs to called once inside the loop so these have been moved out. As I don't have your data I was unable to test this code.