/// <summary> /// returns enumerator with scalar variables /// </summary> /// <param name="comObject"></param> /// <returns></returns> public static IEnumerator GetScalarEnumeratorAsMethod(COMObject comObject) { Factory.CheckInitialize(); object enumProxy = Invoker.MethodReturn(comObject, "_NewEnum"); COMObject enumerator = new COMObject(comObject, enumProxy, true); Invoker.MethodWithoutSafeMode(enumerator, "Reset", null); bool isMoveNextTrue = (bool)Invoker.MethodReturnWithoutSafeMode(enumerator, "MoveNext", null); while (true == isMoveNextTrue) { object item = Invoker.PropertyGetWithoutSafeMode(enumerator, "Current", null); isMoveNextTrue = (bool)Invoker.MethodReturnWithoutSafeMode(enumerator, "MoveNext", null); yield return(item); } }
/// <summary> /// returns enumerator with com proxies /// </summary> /// <param name="comObject"></param> /// <returns></returns> public static IEnumerator GetProxyEnumeratorAsProperty(COMObject comObject) { Factory.CheckInitialize(); object enumProxy = Invoker.PropertyGet(comObject, "_NewEnum"); COMObject enumerator = new COMObject(comObject, enumProxy, true); Invoker.MethodWithoutSafeMode(enumerator, "Reset", null); bool isMoveNextTrue = (bool)Invoker.MethodReturnWithoutSafeMode(enumerator, "MoveNext", null); while (true == isMoveNextTrue) { object itemProxy = Invoker.PropertyGetWithoutSafeMode(enumerator, "Current", null); COMObject returnClass = Factory.CreateObjectFromComProxy(enumerator, itemProxy); isMoveNextTrue = (bool)Invoker.MethodReturnWithoutSafeMode(enumerator, "MoveNext", null); yield return(returnClass); } }