Lets say i have a form which have the following :
Name:TextBox
Email:TextBox
Age:TextBox
now i want to Get customers Collection based on this filter textboxs
so i want to to use something like :
List<customer> customers = getCustomerswhere(c=>c.name == txtName.Text && Email == txtEmail.Text);
now of course i dont know which he will fill and which he wont so
if (txtName.Text.trim() != "")
//something like c=>c.Name == txtName.text;
if (txtEmail.Text.trim() != "")
//something like and c=>c.Email == txtEmail.text;
how do i do this ! i cant concatenate lambda expressions , i know i can use dynamic expressions but i think there is easier way ? any idea how to implement this ?
ok i tried this:
Func<Customer,bool > a = (bb) => bb.fullName == "asdfsd";
Func<Customer, bool> b = c => c.lastName == "sdas";
Func<Customer, bool> cc = c => a(c) && b(c);
now comes another problem
the method im passing CC to is expecting Expression<Func<T, bool>> expression
so it doesnt work gives me compile time error cant convert between types!