I want to return an empty List of type filters thats part of my webservice. When my page loads it doesn't have checkboxes selected so I need to return an empty List
我想返回一个空的List类型过滤器,它是我的webservice的一部分。当我的页面加载时,它没有选中复选框,所以我需要返回一个空列表
public class ProductsAndFilters
{
public List<Filter> Filters {get; set; }
public List<Product> Products {get; set; }
}
public ProductsAndFilters GetProductsAndFilters(json data)
{
ProductsAndFilters pf = new ProductsAndFilters();
pf.Products = products;
pf.Filters = empty filters list here
return pf;
}
2 个解决方案
#1
3
just set
pf.Filters = new List<Filter>();
#2
3
new List<Filter>();
should work.
新列表
#1
3
just set
pf.Filters = new List<Filter>();
#2
3
new List<Filter>();
should work.
新列表