c# - search my list help with linq -


i have

    list<fruitobj>       fruit     fruitname, fruitcolor     banana, yellow     orange, orange     cherry, red      list<fruitobj> test = new list<fruitobj>(); 

is there inline way of searching list starts ban , return true if contain string?

bool hasban = test.any( x => x.fruitname.startswith("ban")); 

note case sensitive, match "banana" do:

bool hasban = test.any( x => x.fruitname.startswith("ban", stringcomparison.invariantcultureignorecase)); 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -