How to get the value of the passed parameter of the Func<>
Lambda in C#
IEnumerable<AccountSummary> _data = await accountRepo.GetAsync();
string _query = "1011";
Accounts = _data.Filter(p => p.AccountNumber == _query);
and this is my extension method
public static ObservableCollection<T> Filter<T>(this IEnumerable<T> collection, Func<T, bool> predicate)
{
string _target = predicate.Target.ToString();
// i want to get the value of query here.. , i expect "1011"
throw new NotImplementedException();
}
I want to get the value of query inside the Filter extension method assigned to _target
Expression<Func<T,bool>>
to get that info. – Volatilizepredicate.Body....Right
– Limen