C#????Lambda??Expression????????????
???????????? ???????[ 2013/9/2 10:23:15 ] ????????
????????????????У?????????????????????£????????????????????
???????????????????????????д??
public class Helper : INotifyPropertyChanged
{
#region statusInfo Property
private string statusInfo_ = "";
public string statusInfo_pro
{
get
{
return statusInfo_;
}
set
{
if (value == statusInfo_)
{
return;
}
statusInfo_ = value;
NotifyPropertyChanged(() => statusInfo_pro);
}
}
#endregion
#region statusInfo NotifyPropertyChanged
public void NotifyPropertyChanged<T>(Expression<Func<T>> property)
{
if (PropertyChanged == null)
{
return;
}
var memberExpression = property.Body as MemberExpression;
if (memberExpression == null)
{
return;
}
PropertyChanged.Invoke(this?? new PropertyChangedEventArgs(memberExpression.Member.Name));
}
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
private Helper helper_=new Helper();
private void binding()
{
textbox1.DataBindings.Add("Text"??helper??"statusInfo_pro");
}
????????Helper???н??INotifyPropertyChanged????????????????????????INotifyPropertyChanged????
????????????????????????????Helper.statusInfo_pro?????????????????????????????????????μ??????Helper.statusInfo_pro??????????????binding?????????????£?
private void binding()
{
textbox1.DataBindings.Add("Text"??helper??"statusInfo_pro"??false??DataSourceUpdateMode.OnPropertyChanged);
}
??????
![](/images/ad-banner/ad-banner.png)
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11