C#C
C#2y ago
8 replies
sideburns_01

Passing Lambda as a method parameter: Some issues

I am building an IQueryable extension that can perform queries on nested object properties (that is the hope).

I would like to apply this extension to a class, then pass the desired nested object to the extension to further build a where clause
Here is an example of how I would call the extension:
_context.ClassA.CustomExtension(a => a.ClassB) (ClassB is an object instance on Class A)

All examples online show some expression that returns a value, however in this case I don't have one. I just want the extension to know it should query this nested Class on _context.ClassA. Not sure how to set up the parameter.

What is the correct way to go about this?
Was this page helpful?