c# - Implicitly convert type 'string' to 'bool' -
i have deal question: filter student in list result "pass". when write code in picture below, return wrong caution this: cannot implicitly convert type 'string' 'bool'. although used convert.toboolean(t.result) can't work?
help me!
to filter student in list result "pass" need add condition as:
lst.where(t => t.result=="pass").tolist();
you can same boolean property instead string, property definition like:
public bool result { { return score > 25; } }
so iterative condition filtering student in list result "pass"(score > 25)
lst.where(t => t.result).tolist();
Comments
Post a Comment