【问题标题】:Can I use aspects to automagically implement INotifyPropertyChanged我可以使用方面自动实现 INotifyPropertyChanged
【发布时间】:2013-10-22 10:49:30
【问题描述】:

有没有办法使用 PostSharp 来更改这种代码:

private _property;
public Object Property
{
    get { return _property; }
    set
    {
        if (_property != value)
        {
            _property = value;
            PropertyChanged("Property");
        }
    }
}

变成类似:

[NotifyChanged]
public Object Property { get; set; }

?

【问题讨论】:

  • 不知道 PostSharp,但 Fody 做得很好。

标签: c# wpf inotifypropertychanged postsharp aspects


【解决方案1】:

这里有很好的说明:

http://www.postsharp.net/aspects/examples/inotifypropertychanged

这似乎与您要查找的内容相符。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-12-19
    • 2011-09-27
    • 1970-01-01
    • 2011-04-08
    • 2012-04-05
    • 1970-01-01
    • 2023-03-29
    相关资源
    最近更新 更多