![](/img/trans.png)
[英]Retrieve all the items from a table where the text of a table column is contained in a list of items (ASP.NET Core 2.2 C# LINQ)
[英]How to display all items in a list without satisfying a particular condition in C#,ASP.NET CORE?
是否可以通过 FindAll()? 我不这么认为,因为 FindAll() 总是需要一个条件,对吗? 有没有办法做到这一点?有人可以帮忙吗
这是我的清单
studentlist = new List<StudentModel>()
{
new StudentModel{id=1,fname="john",lname="joseph",location="trivandrum",contact=786789876,email="j@gmail.com",password="a",roles="Employee" },
new StudentModel{id=2,fname="sam",lname="joseph",location="kollam",contact=786789876,email="sam@gmail.com",password="b",roles="Admin" }
};
您可以使用 Linq 来执行此操作。 如果你想要所有不满足你条件的东西,那就否定它。 它会是这样的:
studentlist.Where(!yourCondition).ToList();
您还可以使用 All() 方法:
studentlist.All(condition).ToList();
但是,如果您需要全部,只需将(或您想以任何方式显示)直接绑定到您的studentlist
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.