While (b!=0)
{
Var a=data_list. DataList. ToList () [0].
I in data_list foreach (var. The DataList. ToList ())
{
//var get_stock=_orderService. Get_erp_stock_list (new StockQueryRequest modity} {commodity=i.com, merchant_id);
If (i.com modity_name. Equals modity_name) (a.com)
{
Data_list. DataList. ToList (). The RemoveAt (1);
}
B=b - 1;
}
}
CodePudding user response:
Red part have a problem for certain,Data_list. DataList. ToList () . The RemoveAt (1)
CodePudding user response:
////abstract:
//create System. Collections. Generic. List ` 1 from the System. Collections. Generic. IEnumerable ` 1,
//
//parameters:
//source:
//System. Collections, Generic IEnumerable ` 1 create System. Collections. ` Generic. List 1
//from,
//
//type parameters:
//TSource:
//the type of the elements in the source,
//
//return the result:
//a System. Collections. Generic. List ` 1, which contains the elements in the input sequence,
//
//exception:
//T: System. ArgumentNullException:
//source is null,
Public static List
ToList () will get a new collection, will not change the original collection
CodePudding user response:
I also think it is ToList () question but don't know how to changeCodePudding user response:
Total felling you go wrong...Data_list DataList is a result set?
Is nothing more than you want to the result set to the selected?
That you directly use the expression to get a new result set.
CodePudding user response:
Data_list. DataList. ToList (). The RemoveAt (1); To data_list. DataList. ToList (). Remove (I);CodePudding user response:
IListL=l.D istinct (.) ToList ();
Don't know what you structure this can go
CodePudding user response:
Data_list. DataList. Select (x=& gt; X.com modity_name! Modity_name)=a.comCodePudding user response:
Don't delete list in foreach, use a for loop for (int=list. The count, i>=0; I++), referenceor Iterator.
https://www.cnblogs.com/huzi007/p/10483857.html
CodePudding user response:
Have very detailed answer # 1, 2,Don't go into,
CodePudding user response:
Give you a look at the real, mainly tolist, operating data are different,Creates a new generic collections
CodePudding user response: