How to pass predicate to function in C#?
asp.net, c#, c#-4.0, predicate
Solution
`Func<Entry, bool> predicate` should work, where `Entry` is type of `entry` variable.
Problem
I have : ``` public void InitializeStatusList(DropDownList list) { var dictionaryEntries = GetEntriesFromDatabase(); list.DataSource = dictionaryEntries.Where(entry => entry is EntryStatus1 || entry is EntryStatus2); list.DataBind(); } ``` I have many of these functions. I want to write common function with `dictionaryEntries` query condition passed as predicate. For example: ``` public void InitializeStatusList(DropDownList list) { CommonInitializeStatusList(DropDownList list, entry => entry is EntryStatus1 || entry is EntryStatus2); } public void CommonInitializeStatusList(DropDownList list, ??????????????? predicate) { var dictionaryEntries = GetEntriesFromDatabase(); list.DataSource = dictionaryEntries.Where(predicate); list.DataBind(); } ``` What stands for `???????????????` Thanks in advance