I want to create a function that recieve one parameter:
1. delegate that get any MyObj instance and returns a key (like OrderBy method).
So I can do the following:
function IQueryable<Worker> doSomething(Func<Worker, TKey> getter) {
Workers.Where(x=>getter(x)==9);
}
This method should work with the entity framework. TKey is not defind. How can I do it?
If you want to compare it to a specific type, like an integer, just use that type in the signature:
Otherwise you would have to include it as a generic type and provide a value of that type for the comparison: