您好,我如何从通用列表中删除项目这是我的代码,我试图正确地做,但我不知道我在哪里犯了错误;/
Users us_end = new Users();
foreach (var VARIABLE in ((List<Users>)Application["Users_On"]))
{
if(VARIABLE.Id == (int)Session["Current_Id"])
{
us_end.Name = VARIABLE.Name;
us_end.Id = VARIABLE.Id;
us_end.Data = VARIABLE.Data;
}
}
List<Users> us = ((List<Users>)Application["Users_On"]);
us.Remove(us_end);
Application["Users_On"] = us;