I want to write a method with signature Expression<Func<T, bool>> Foo<T>(). My class U inherits from T. I want to include U-specific processing in this delegate. The problem is, T can’t be implicitly converted to U. Is there any way I can access U-specific properties in this method?
Complication: I also have type V : T which I want to be handled, so I can’t just take advantage of variance by replacing T with U in the signature.
I ended up using separate overloads: (), (myVar) where T : U, and (myvar, myvar2) where T : V. That did the trick and I lucked out because each parameter is an app value that corresponds with an entity property.