public override DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value) { ContractUtils.RequiresNotNull(binder, "binder"); return binder.Defer(WrapSelf(), indexes.AddLast(value)); }
public override DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value) { // // Demand Full Trust to proceed with the binding. // new PermissionSet(PermissionState.Unrestricted).Demand(); ComMethodDesc method; var target = _callable.DispatchComObject; var name = _callable.MemberName; bool holdsNull = value.Value == null && value.HasValue; if (target.TryGetPropertySetter(name, out method, value.LimitType, holdsNull) || target.TryGetPropertySetterExplicit(name, out method, value.LimitType, holdsNull)) { bool[] isByRef = ComBinderHelpers.ProcessArgumentsForCom(ref indexes); isByRef = isByRef.AddLast(false); var result = BindComInvoke(method, indexes.AddLast(value), binder.CallInfo, isByRef); // Make sure to return the value; some languages need it. return new DynamicMetaObject( Expression.Block(result.Expression, Expression.Convert(value.Expression, typeof(object))), result.Restrictions ); } return base.BindSetIndex(binder, indexes, value); }
public override DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value) { ContractUtils.RequiresNotNull(binder, "binder"); ComMethodDesc setItem; if (_self.TryGetSetItem(out setItem)) { bool[] isByRef = ComBinderHelpers.ProcessArgumentsForCom(ref indexes); isByRef = isByRef.AddLast(false); var result = BindComInvoke(indexes.AddLast(value), setItem, binder.CallInfo, isByRef); // Make sure to return the value; some languages need it. return new DynamicMetaObject( Expression.Block(result.Expression, Expression.Convert(value.Expression, typeof(object))), result.Restrictions ); } return base.BindSetIndex(binder, indexes, value); }