I'm assuming the object you're trying to cast is a Mendix proxy object? In that case you should use the getMendixObject()
method of that proxy object to obtain a IMendixObject
:
inspectionTimeListIMO.add(inspectionTimeListElement.getMendixObject());