You can use the IMeasure tool. You can either select the entities and calculate the distance or pass the array of entities into the Calculate method directly. Here is the example: #CODE|Measure the Distance Between Selected Entities
The information is very useful.
thank you very much.