简体   繁体   中英

How do update an item in an ObservableCollection?

I have and ObservableCollection but for some reason this code does not work.

 private void UpdateChildrenInClass()
    {
        var item = ChildrenInClass.FirstOrDefault(i => i.Name == CurrentChild.Name);
        if (item != null)
        {
            item = CurrentChild;

        }
    }

item displays the currentChild properties but if you look In ChidrenInClass the item properties have not been updated.

问题是项目指向我要更新的ObservableCollection中的对象,但随后我将项目设置为指向另一个对象(CurrentChild)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM