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

  • Home
  • SEARCH
  • 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 8494301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:15:45+00:00 2026-06-10T23:15:45+00:00

I have a list contains many Blocks, and the Blocks are divided into old

  • 0

I have a list contains many Blocks, and the Blocks are divided into old ones and new ones, using a property ‘IsOld’ in class ‘Block’ to specify them. Now I extract the old ones like this:

List<Block> olds = blocks.Where(item => {return item.IsOld;}).ToList();

and after I change some values of the properties on the items in ‘olds’ list, the corresponding ones in the original list ‘blocks’ do not change. And I don’t know how to deal with it. And that means if I use List.Where method, it will make a deep copy for every item?


‘Block’ is a struct and I first thought it was a class.
so sorry to trouble you because of my careless o(︶︿︶)o

  • 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-10T23:15:46+00:00Added an answer on June 10, 2026 at 11:15 pm

    You are saying that you are changing values of properties, and not replacing the objects themselves. Therefore the original objects in the blocks list should also be updated, that is if Block is defined as a class-type. If Block is a struct, than every assignment is done in a copy of the original object, and then your changes in the olds list should not be reflected in the original blocks list.

    Is Block a struct?

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

Sidebar

Related Questions

I've got a class that contains (among many other things) a list of items
I have a list that contains many objects.I want found an object in this
I have a list that contains many sub-lists of 3 elements each, like: my_list
I have a typical Parent contains many Children (List) relationship. How do I tell
I have the following: Folder that contains many files (about 300000), named AllFilesFolder list
Possible Duplicate: Randomize a List<T> in C# I have a list which contains many
I have a list that contains many dictionaries. Each dictionary represents a change that
I have a scrolling DIV, which contains a list of many items: ___________ |
I have a List collection that contains a List subcollection as a property within
I have a list of imperfections in my code: the list contains the name

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.