示例#1
0
 /// <summary>
 /// Tries to perform binding of the dynamic set member operation.
 /// </summary>
 /// <param name="binder">An instance of the <see cref="SetMemberBinder"/> that represents the details of the dynamic operation.</param>
 /// <param name="instance">The target of the dynamic operation.</param>
 /// <param name="value">The <see cref="DynamicMetaObject"/> representing the value for the set member operation.</param>
 /// <param name="result">The new <see cref="DynamicMetaObject"/> representing the result of the binding.</param>
 /// <returns>true if operation was bound successfully; otherwise, false.</returns>
 public static bool TryBindSetMember(SetMemberBinder binder, DynamicMetaObject instance, DynamicMetaObject value, out DynamicMetaObject result)
 {
     if (TryGetMetaObject(ref instance))
     {
         result = instance.BindSetMember(binder, value);
         result = new DynamicMetaObject(result.Expression, result.Restrictions.Merge(value.PSGetMethodArgumentRestriction()));
         return true;
     }
     else
     {
         result = null;
         return false;
     }
 }