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 8001745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:09:58+00:00 2026-06-04T16:09:58+00:00

How do I use an update method in C5 collection ? For example, lets

  • 0

How do I use an update method in C5 collection?

For example, lets say I have a set where I want to replace item A with B. I’d expect it to be something like:

HashSet<String> s = new HashSet<String>();
s.add("A");
s.update("A", "B");

but instead, Update takes a single parameter, and the documentation has the following to say:

bool Update(T x) returns true if the collection contains an item equal
to x, in which case that item is replaced by x; otherwise returns
false without modifying the collection. If any item was updated, and
the collection has set semantics or DuplicatesByCounting is false,
then only one copy of x is updated; but if the collection has bag
semantics and DuplicatesByCounting is true, then all copies of the old
item are updated. If any item was updated, then events ItemsRemoved,
ItemsAdded and CollectionChanged are raised. Throws Read-
OnlyCollectionException if the collection is read-only.

Any ideas? Thanks.

  • 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-06-04T16:10:00+00:00Added an answer on June 4, 2026 at 4:10 pm

    I think you need to do this with two separate operations:

    s.Remove("A");
    s.Add("B");
    

    The Update method only works if the two items are considered equal (two different objects can be equal). But "A" and "B" are not equal.

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

Sidebar

Related Questions

I use the fallowing method to update a contact in Exchange over EWS: private
I use EGORefreshTableHeaderView to update my tableview. Here I call my method to download
I have a web page that I use to update a fairly complex data
As in the backbone-todolist example,I have a collection of elements. I made 2 views,
I've some classes, for example, Parent and Children. Parent have a collection of Children
Sounds simple enough, but its not working. In this example, I want to set
I have a method that I want to be transactional in the abstract sense.
I use NHibernate with the Repository-Pattern. The Repositories has the Methods Insert() and Update().
I need to use scp update some directory at another server. It is similar
I am trying to use an update query to update the first 3 characters

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.