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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:15:01+00:00 2026-05-14T22:15:01+00:00

I was wondering, and i’m not really sure, but help me out here. If

  • 0

I was wondering, and i’m not really sure, but help me out here.

If you have a List items, and there’s one object you need to change a property of it.
Say myClass has a string property “status”. I’m searching my list with a for-loop and i get my object so i do

myClass item = items[i];

if i want to change the “status” property, i do this for example :

item.Status = "new status";

My question/issue is this: is “item” still linked to the list item, so that if i execute the line above, it will be changed in the list as well without having to set this :

items[i] = item;

Hope this is clear.

Thanks in advance.

  • 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-14T22:15:02+00:00Added an answer on May 14, 2026 at 10:15 pm

    The code item.Status = "new status"; will change the list item

    items[i] points to a myClass object.

    When you say myClass item = items[i];, it is referenced by both item and items[i].

    so when you alter one of the properties like this item.Status = "new status"; you’re actually making changes to your myClass object which now has two names item and items[i].

    You can also use item[i].Status = "new status";. Both do the same job.

    Setting items[i] = item; has no effect, since both reference the same object already.

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

Sidebar

Related Questions

wondering if there's any way to make it so that a list I have
Wondering if someone could help me. I have next to no knowledge with Ajax,
Wondering if anyone out there might know a trick to a small sql script.
Wondering if there is any php script out there which takes an sql db
wondering if anyone can help. This works, but I was wondering how it would
Wondering if anyone can help me. I have a site (for the moment )
Wondering if Riak has anything that would help one synchronize data between a mobile
Wondering if there's any not-too-hard way to edit non-form text in html 4. I
Wondering if anyone out there has ran into this before.... I'd like to use
Wondering if you could help me with a simple SQL query. I have included

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.