'how to assign value in asp.net List variable?

I have list variable which is filled by data fetch from db in code behind. After fetching data in list , can i replace a list variable value? here is my list

public  class SummaryInformation
{
   
    public long Id { get { return parent.Id; } }

    public string TypeCode { get { return parent.TypeCode; } }
}

Code for fetching data and replacing list value

string sTypeCode = "C"
SummaryInformation account = Account.GetSummary(long.Parse(lb.CommandArgument), currentUser, lb.Attribute("Id"));
List<SummaryInformation> accounts = new List<SummaryInformation>();

Now once the list loaded here from db data then can i replace TypeCode db value with my value in list? like below

accounts.ElementAt(1) = sTypeCode ;

i am getting error when i tried to assign list value like this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source