KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This is probably a basic question for some, but it affects how I design a piece of my program. I have a single collection of type A: IEnumerable<A> myCollection; I am filtering my collection on 2 different criteria: IEnumerable<A> subCollection1 = myCollection.Where(x => x.Count > 10); etc. Now, I know that the .Where expression will return a new instance of IEnumerable, but does the new collection contain the same reference to an instance of type A that 'myCollection' references, or are new copies of type A created? If new instances of type 'A' are created, is there a way to say that 'subCollection1' references the same instances of A as 'myCollection' references? Edit: To Add further clarification. I am looking for a way so that when I make a change to an instance of 'A' in 'subCollection1', that it is also modified for 'myCollection'.
Tags (comma-separated)
Save Edits
Cancel