I am trying to convert from
x => x.SomeProperty
to
x => x.SomeProperty is ISomeInterface
In a method that fits the following signature:
Func<TSource, bool> Convert(Expression<Func<TSource, TSourceMember>> source);
Where SomeProperty might be a collection or a single object. Can anyone help?
I'm finding it difficult to work out what kind of expressions these are. I think that the first one is a MemberExpression and the second is a UnaryExpression.
I'd be happy to move the
x.SomeProperty is ISomeInterface
logic into a method if that would make things easier.
bool IsSomeInterface(object obj)
{
return obj is ISomeInterface;
}
Any pointers or tutorials on how to put this stuff together would be appreciated. I always seem to struggle with Expression trees.