public void ClearReferences() { if (accessor.IsReference) { foreach (var item in items) { references.OnAssigningNull(item.Node, item.Value); } } }
protected void RemoveCollectionItems(IXmlNode parentNode, XmlReferenceManager references, object value) { var collection = value as ICollectionProjection; if (collection != null) { collection.Clear(); return; } var itemType = clrType.GetCollectionItemType(); var accessor = GetCollectionAccessor(itemType); var cursor = accessor.SelectCollectionItems(parentNode, true); var isReference = IsReference; var items = value as IEnumerable; if (items != null) { foreach (var item in items) { if (!cursor.MoveNext()) { break; } if (isReference) { references.OnAssigningNull(cursor, item); } } } cursor.Reset(); cursor.RemoveAllNext(); }
private void RemoveCore(int index) { EndNew(addedIndex); var item = items[index]; DetachPropertyChanged(item.Value); if (accessor.IsReference) { references.OnAssigningNull(item.Node, item.Value); } cursor.MoveTo(item.Node); cursor.Remove(); items.RemoveAt(index); NotifyListChanged(ListChangedType.ItemDeleted, index); }
protected void RemoveCollectionItems(IXmlNode parentNode, XmlReferenceManager references, object value) { var collection = value as ICollectionProjection; if (collection != null) { collection.Clear(); return; } var itemType = clrType.GetCollectionItemType(); var accessor = GetCollectionAccessor(itemType); var cursor = accessor.SelectCollectionItems(parentNode, true); var isReference = IsReference; var items = value as IEnumerable; if (items != null) { foreach (var item in items) { if (!cursor.MoveNext()) break; if (isReference) references.OnAssigningNull(cursor, item); } } cursor.Reset(); cursor.RemoveAllNext(); }