Is it possible to use placeholders in C# expression? I have a expression for filtering records in a datagrid as follows:
view.Filter = item =>
{
OrdsRlsd vitem = item as OrdsRlsd;
if (vitem.OrderNo >= Convert.ToInt32(TxtCond1.Text) && vitem.OrderNo <= Convert.ToInt32(TxtCond2.Text))
{
return true;
}
return false;
};
In this expression, the the comparison operators and the TxtCond1 and TxtCond2 values are dynamic. Can we use a placeholder for that?
Yes you can pass those as
Func<string>parameters. So say your function definition is like this