我正在为 Windows 手机使用 Daniel Mohl 的 F# 模板,但捆绑的 FSharp.Core 似乎没有一些报价代码。我正在尝试从常规 .NET 移植此代码:
open System.ComponentModel
open Microsoft.FSharp.Quotations
open Microsoft.FSharp.Quotations.Patterns
[<AbstractClass>]
type ViewModelBase() =
let propertyChanged = new Event<_, _>()
let toPropName expr =
match expr with
| PropertyGet(a, b, list) -> b.Name
| _ -> failwith "Unsupported: " + expr.ToString()
interface INotifyPropertyChanged with
[<CLIEvent>]
member x.PropertyChanged = propertyChanged.Publish
member x.NotityPropertyChanged expr =
propertyChanged.Trigger(x, new PropertyChangedEventArgs(toPropName expr))
但是编译器抱怨 Microsoft.FSharp.Quotations.Patterns 和 PropertyGet。它似乎甚至不知道 Expr 类型。关于如何解决这个问题的任何想法?