INotifyPropertyChanged的和自动属性 [英] INotifyPropertyChanged and Auto-Properties

查看:704
本文介绍了INotifyPropertyChanged的和自动属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用 INotifyPropertyChanged的具备自动性能的方法吗?也许一个属性或其他东西,而不是明显对我

Is there a way to use INotifyPropertyChanged with auto-properties? Maybe an attribute or something other, not obvious to me.

public string Demo{
    get;set;
}



对于我来说,汽车性能将是一个非常practicall的事情,但几乎总是,我必须提出的的PropertyChanged -event如果属性值已经改变,没有一个机制来做到这一点,自动属性是无用的我。

For me, auto-properties would be an extremely practicall thing, but almost always, I have to raise the PropertyChanged-event if the property value has been changed and without a mechanism to do this, auto-properties are useless for me.

推荐答案

有没有内置的机制来做到这一点。如 PostSharp 的东西很可能能够这样添加的东西对你(或马克Gravell的的 HyperDescriptor ,如果​​你在使这个数据绑定感知)

There's no built-in mechanism to do this. Something like PostSharp would likely be able to add something like this for you (or Mark Gravell's HyperDescriptor, if you're just interested in making this databinding-aware).

这篇关于INotifyPropertyChanged的和自动属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆