-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathObservableClass.cs
More file actions
24 lines (22 loc) · 831 Bytes
/
ObservableClass.cs
File metadata and controls
24 lines (22 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.ComponentModel;
namespace FSClient {
public class ObservableClass : INotifyPropertyChanged {
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string name) {
VerifyProperty(name);
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
[System.Diagnostics.Conditional("DEBUG")]
private void VerifyProperty(string propertyName) {
Type type = GetType();
System.Reflection.PropertyInfo pi = type.GetProperty(propertyName);
if (pi == null) {
string msg = "OnPropertyChanged was invoked with invalid property name {0}. {0} is not a public property of {1}.";
msg = String.Format(msg, propertyName, type.FullName);
System.Diagnostics.Debug.Fail(msg);
}
}
}
}