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

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

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -