Some times ago I asked a question here “How to add an item in a collection using Linq and C#”
For Example I have same collection:
List<Subscription> subscription = new List<Subscription>
{
new Subscription{Type = "Trial", Period = 30 },
new Subscription{Type = "Free", Period = 90 },
new Subscription{Type = "Paid", Period = 365 }
};
Now I want to update an item of this list using C# code. Is it possible?
Your subscription list contains 3 references to 3 Subscription objects. If you update any one of the 3 subscription objects in that list (through whatever means) then the list will reference the updated element.
Will update the subscription object.. List won’t change but it references the same object which has been updated