Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string MyProperty
- {
- get { return _myProperty; }
- set
- {
- if (value != _myProperty)
- {
- _myProperty = value;
- NotifyPropertyChanged("MyProperty");
- // This line above could be improved by replacing the literal string with
- // a pre-processor directive like "#Property", which could be translated
- // to the string value "MyProperty" This new notify call would be as follows:
- // NotifyPropertyChanged(#Property);
- }
- }
- }
- public static string MyPropertyPropertyName
- public string MyProperty {
- get { return _myProperty; }
- set {
- if (!String.Equals(value, _myProperty)) {
- _myProperty = value;
- NotifyPropertyChanged(MyPropertyPropertyName);
- }
- }
- }
- // in the consumer.
- private void MyPropertyChangedHandler(object sender,
- PropertyChangedEventArgs args) {
- switch (e.PropertyName) {
- case MyClass.MyPropertyPropertyName:
- // Handle property change.
- break;
- }
- }
- public static string GetNameOfCurrentMethod()
- {
- // Skip 1 frame (this method call)
- var trace = new System.Diagnostics.StackTrace( 1 );
- var frame = trace.GetFrame( 0 );
- return frame.GetMethod().Name;
- }
Add Comment
Please, Sign In to add comment