Пример #1
0
        public override Dynamic GetItem(Dynamic index)
        {
            const BindingFlags flags = BindingFlags.InvokeMethod | BindingFlags.OptionalParamBinding;

            object obj = NativeType.IsCOMObject
                       ? NativeType.InvokeMember("Item", flags, null, handle, new[] { index.AsNativeObject })
                       : NativeType.InvokeMember("get_Item", flags, new DynamicBinder(), handle, new[] { index });

            return(DynamicFactory.CreateDynamic(obj));
        }
Пример #2
0
        public override void SetItem(Dynamic index, Dynamic value)
        {
            const BindingFlags flags = BindingFlags.InvokeMethod | BindingFlags.OptionalParamBinding;

            if (NativeType.IsCOMObject)
            {
                NativeType.InvokeMember("Item", flags, null, handle, new[] { index.AsNativeObject, value.AsNativeObject });
            }
            else
            {
                NativeType.InvokeMember("set_Item", flags, new DynamicBinder(), handle, new[] { index, value });
            }
        }