Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6164095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:56:10+00:00 2026-05-23T21:56:10+00:00

How do I update a single item in an ObservableCollection class? I know how

  • 0

How do I update a single item in an ObservableCollection class?

I know how to do an Add. And I know how to search the ObservableCollection one item at a time in a “for” loop (using Count as a representation of the amout of items) but how do I chage an existing item. If I do a “foreach” and find which item needs updating, how to I put that back into the ObservableCollection>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:56:10+00:00Added an answer on May 23, 2026 at 9:56 pm

    You don’t need to remove item, change, then add. You can simply use LINQ FirstOrDefault method to find necessary item using appropriate predicate and change it properties, e.g.:

    var item = list.FirstOrDefault(i => i.Name == "John");
    if (item != null)
    {
        item.LastName = "Smith";
    }
    

    Removing or adding item to ObservableCollection will generate CollectionChanged event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to update a single datarow in a datatable using multiple threads. Is
I know I can update a single record like this - but then how
I am trying to display a single item (not contained in a collection) using
Currently I update a single item in a database as follows: var master =
Is it possible to update a single item within a spinner when it is
The following code works: List<JsonStock> stock = new List<JsonStock>(); foreach(tblStock item in repository.Single(id).tblStocks) stock.Add((JsonStock)
I am trying to update a single motor control application into a program that
How can I write single UPDATE query to change value of COL1 to ‘X’
What is the most efficient way to go through and update every single node
Long story short is I tried to quickly update a single row in SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.