CSharp

 System.ComponentModel.INotifyPropertyChanged インターフェイスの実装によって、プロパティの値の変更を追跡できますし、変更された値の有効性の検証も同時に行うことができる特徴があります。

 よりいいSystem.ComponentModel.INotifyPropertyChangedインターフェイスの実装例:

 public event PropertyChangedEventHandler PropertyChanged;
 
 protected void ValidateProperty(string memberName, object value)
 {
     if (!string.IsNullOrEmpty(memberName) && value != null)
    {
         if (value is string)
             value = value.ToString().Trim();
 
         Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = memberName });
     }
 }
 
 protected void RaisePropertyChanged(string propertyName)
 {
     if ((this.PropertyChanged != null))
     {
         PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
     }
 }


iディレクトリで複数のポータルサイトにディレクトリ登録

コメント:



(画像の文字列を入力して下さい)

トップ   編集 凍結 差分 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2019/12/02 (月) 12:33:10 (1627d)

G|Cg|C@Amazon Yahoo yV

z[y[W yVoC[UNLIMITȂ1~] COiq COsیI