コード例 #1
0
        CompletionHelper(object internalInstance)
        {
            MatchesPattern = (MatchesPatternDelegate)completionHelperType
                             .GetMethod(nameof(MatchesPattern))
                             .CreateDelegate(typeof(MatchesPatternDelegate), internalInstance);

            CompareItems = (CompareItemsDelegate)completionHelperType
                           .GetMethod(nameof(CompareItems))
                           .CreateDelegate(typeof(CompareItemsDelegate), internalInstance);
        }
コード例 #2
0
        /// <summary>
        /// Public constructor for direct use of this class.
        /// </summary>
        /// <param name="compareItemsCallback">Delegate for comparing identity of items in the source and destination collections.</param>
        /// <param name="addItemCallback">Delegate for adding items to the destination collection.</param>
        /// <param name="updateItemCallback">Delegate for updating items in the destination collection, or null if items should not be updated.</param>
        /// <param name="removeCallback">Delegate for removing items from the destination collection, or null if items should not be removed.</param>
        public CollectionSynchronizeHelper(
            CompareItemsDelegate compareItemsCallback,
            AddItemDelegate addItemCallback,
            UpdateItemDelegate updateItemCallback,
            RemoveItemDelegate removeCallback)
        {
            _compareItemsCallback = compareItemsCallback;
            _addItemCallback      = addItemCallback;
            _updateItemCallback   = updateItemCallback;
            _removeItemCallback   = removeCallback;

            _allowUpdate = _updateItemCallback != null;
            _allowRemove = _removeItemCallback != null;
        }