ReactiveUI has methods with signitures like
public static ReactiveUI.ObservableAsPropertyHelper<TRet>
ObservableToProperty<TObj, TRet>(
this TObj This,
System.IObservable<TRet> observable,
System.Linq.Expressions.Expression<System.Func<TObj, TRet>> property,
TRet initialValue = null,
System.Reactive.Concurrency.IScheduler scheduler = null
)
In F# How would I construct an object like
System.Linq.Expressions.Expression<System.Func<TObj, TRet>> property,
In C# I would do something like
this.ObservableAsPropertyHelper(
observable,
me => me.MyProperty
)
EDIT
I've tried
m.ObservableToProperty(this, value, fun me -> me.Property )
and
m.ObservableToProperty(this,
value,
new Linq.Expression.Expression(fun me -> me.Property )
but neither work
I'm not sure if the new F# 3 query expressions help you, but the old PowerPack (which still works great!) has an extension method Expr.ToLinqExpression() : Expression
, to compile F# quotation expressions (i.e. <@ fun me -> me.MyProperty @>
) into LINQ expressions.
Edit: As Daniel had pointed out, QuotationToLambdaExpression does the works, for F# 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With