As IList (o). The Add (o);
As IList (o). Insert (0, o);
The two statements will quote this exception, may be what reason be cause?
CodePudding user response:
We first have to determine what type of O, such as he had been readolnly collection, such as the list is immutableCodePudding user response:
Assignment size is fixed, if instantiated directly add, there would be no this problem, the insertAfter the assignment can be transformed into list
CodePudding user response:
Such as thisTry
{
Int [] LST=new int [] {1, 2, 3};
Var b=(LST as IList.) the Add (0);
}
The catch (Exception e)
{
//iint [] of course implement ilist, nt [] is, of course, immutable, so he can as ilst but don't add
}
CodePudding user response: