Пример #1
0
        public void Add(IRuleValue value)
        {
            var dataType = value.GetDataType();

            LinkedList <IRuleValue> valueList;

            if (_dataLists.ContainsKey(dataType))
            {
                valueList = _dataLists[dataType];
            }
            else
            {
                valueList = new LinkedList <IRuleValue>();
                _dataLists.Add(dataType, valueList);
            }

            var valueNode = new LinkedListNode <IRuleValue> (value);

            if (valueList.Last == null)
            {
                valueList.AddLast(valueNode);
            }
            else
            {
                valueList.AddAfter(valueList.Last, valueNode);
            }

            value.OnDeleted(() => Delete(dataType, valueNode));
        }