Beispiel #1
0
        public IntPtr MarshalManagedToNative(object ManagedObj)
        {
            ArgumentNullException.ThrowIfNull(ManagedObj);

            if (ManagedObj is EnumeratorViewOfEnumVariant view)
            {
                return(Marshal.GetComInterfaceForObject <object, ComTypes.IEnumVARIANT>(view.GetUnderlyingObject()));
            }

            EnumVariantViewOfEnumerator nativeView = new EnumVariantViewOfEnumerator((IEnumerator)ManagedObj);

            return(Marshal.GetComInterfaceForObject <EnumVariantViewOfEnumerator, ComTypes.IEnumVARIANT>(nativeView));
        }
Beispiel #2
0
        public IntPtr MarshalManagedToNative(object ManagedObj)
        {
            if (ManagedObj == null)
            {
                throw new ArgumentNullException(nameof(ManagedObj));
            }

            if (ManagedObj is EnumeratorViewOfEnumVariant view)
            {
                return(Marshal.GetComInterfaceForObject <object, IEnumVARIANT>(view.GetUnderlyingObject()));
            }

            EnumVariantViewOfEnumerator nativeView = new EnumVariantViewOfEnumerator((IEnumerator)ManagedObj);

            return(Marshal.GetComInterfaceForObject <EnumVariantViewOfEnumerator, IEnumVARIANT>(nativeView));
        }