using (IEclSession eclSession = SessionFactory.CreateEclSession(engine.GetSession()))
{
IEclUri eclUri = eclSession.TryGetEclUriFromTcmUri(stubUri);
if (eclUri != null)
{
//it is a ECL item!
}
else
{
// it is not an ECL URI, probably it is a "normal" Tridion item
}
}