Conversion of Linq expressions
- by Arnis L.
I'm not sure how exactly argument what I'm trying to achieve, therefore - wrote some code:
public class Foo{
public Bar Bar{get;set;}
}
public class Bar{
public string Fizz{get;set;}
}
public class Facts{
[Fact]
public void fact(){
Assert.Equal(expectedExp(),barToFoo(barExp()));
}
private Expression<Func<Foo,bool>> expectedExp(){
return f=>f.Bar.Fizz=="fizz";
}
private Expression<Func<Bar,bool>> barExp(){
return b=>b.Fizz=="fizz";
}
private Expression<Func<Foo,bool>> barToFoo
(Expression<Func<Bar,bool>> barExp){
return Voodoo(barExp); //<-------------------------------------------???
}
}
Is this even possible?