Skip to content

Instantly share code, notes, and snippets.

@jfromaniello
Created January 11, 2011 14:28
Show Gist options
  • Save jfromaniello/774466 to your computer and use it in GitHub Desktop.
Save jfromaniello/774466 to your computer and use it in GitHub Desktop.
//original:
[Required]
public string SomeProperty
{
get { return someProperty; }
set
{
someProperty = value;
if (isInSomeMode) return;
//do some stuff
}
}
//weaved:
[Required]
public string SomeProperty
{
get
{
return this.someProperty;
}
set
{
if (!object.Equals(this.someProperty, value))
{
this.someProperty= value;
if (!this.isInSomeMode)
{
//do some stuff
base.NotifyOfPropertyChange("SomeProperty");
}
}
}
}
//what i would expect:
[Required]
public string SomeProperty
{
get
{
return this.someProperty;
}
set
{
if (!object.Equals(this.someProperty, value))
{
this.someProperty= value;
if (!this.isInSomeMode)
{
//do some stuff
}
base.NotifyOfPropertyChange("SomeProperty");
}
}
}
//I expect the notification every time this.someProperty != value (don't care other code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment