我有以下问题:
我想用 LINQ 成员表达式替换包含属性名称的硬编码字符串
// like this:
NotifyOfPropertyChange("MyProperty");
// becomes
NotifyOfPropertyChange(() => MyProperty);
使用 ReSharper 模式。
以下尝试无效:
NotifyOfPropertyChange("$prop$"); // ($prop$ is of type Identifier, results in parse error)
NotifyOfPropertyChange($prop$); // ($prop$ is of type Expression [System.String],
// almost works, but without removing the quotes
替换模式始终相同:
NotifyOfPropertyChange(() => $prop$);
有任何想法吗?