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!

enter image description here

enter image description here

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

Popular posts from this blog

javascript - Hide toolbar of pdf file opened inside iframe using firefox -

Ansible - ERROR! the field 'hosts' is required but was not set -

Copy range with conditional formatting -