System.Dynamic.BindingRestrictions.Combine C# (CSharp) Method

Combine() public static method

Combines binding restrictions from the list of DynamicMetaObject instances into one set of restrictions.
public static Combine ( IList contributingObjects ) : BindingRestrictions
contributingObjects IList The list of instances from which to combine restrictions.
return BindingRestrictions
        public static BindingRestrictions Combine(IList<DynamicMetaObject> contributingObjects)
        {
            BindingRestrictions res = Empty;
            if (contributingObjects != null)
            {
                foreach (DynamicMetaObject mo in contributingObjects)
                {
                    if (mo != null)
                    {
                        res = res.Merge(mo.Restrictions);
                    }
                }
            }
            return res;
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Defers the binding of the operation until later time when the runtime values of all dynamic operation arguments have been computed.
        /// </summary>
        /// <param name="target">The target of the dynamic operation.</param>
        /// <param name="args">An array of arguments of the dynamic operation.</param>
        /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
        public DynamicMetaObject Defer(DynamicMetaObject target, params DynamicMetaObject[] args)
        {
            ContractUtils.RequiresNotNull(target, nameof(target));

            if (args == null)
            {
                return(MakeDeferred(target.Restrictions, target));
            }

            return(MakeDeferred(
                       target.Restrictions.Merge(BindingRestrictions.Combine(args)),
                       args.AddFirst(target)
                       ));
        }
All Usage Examples Of System.Dynamic.BindingRestrictions::Combine