public JsIterator CreateIterator(IEnumerator enumerator) { if (enumerator == null) { enumerator = Enumerable.Empty <object>().GetEnumerator(); } var objectHandle = m_engine.JsCreateObject(); //this is a special case where we cannot use our CreateValue<> method. return(m_valuePool.GetOrAdd(objectHandle, () => { return new JsIterator(m_engine, Context, objectHandle, enumerator); }) as JsIterator); }