예제 #1
0
        public object MarshalNativeToManaged(IntPtr pNativeData)
        {
            ArgumentNullException.ThrowIfNull(pNativeData);

            object comObject = Marshal.GetObjectForIUnknown(pNativeData);

            return(ComDataHelpers.GetOrCreateManagedViewFromComData <object, EnumerableViewOfDispatch>(comObject, obj => new EnumerableViewOfDispatch(obj)));
        }
예제 #2
0
        public object MarshalNativeToManaged(IntPtr pNativeData)
        {
            ArgumentNullException.ThrowIfNull(pNativeData);

            object comObject = Marshal.GetObjectForIUnknown(pNativeData);

            if (!comObject.GetType().IsCOMObject)
            {
                if (comObject is EnumVariantViewOfEnumerator enumVariantView)
                {
                    return(enumVariantView.Enumerator);
                }

                return((comObject as IEnumerator) !);
            }

            return(ComDataHelpers.GetOrCreateManagedViewFromComData <ComTypes.IEnumVARIANT, EnumeratorViewOfEnumVariant>(comObject, var => new EnumeratorViewOfEnumVariant(var)));
        }