Skip to content

Instantly share code, notes, and snippets.

@jwatte
Last active December 13, 2015 19:19
Show Gist options
  • Save jwatte/4962218 to your computer and use it in GitHub Desktop.
Save jwatte/4962218 to your computer and use it in GitHub Desktop.
Doing reactive/data-flow programming in C# is ludicrously verbose.
public class DrawingFeature : Feature
{
private Drawing drawing_;
public event EventHandler DrawingChanged;
private bool inDrawingChanged_;
protected void OnDrawingChanged()
{
if (!inDrawingChanged_)
{
inDrawingChanged_ = true;
try
{
if (DrawingChanged != null)
{
DrawingChanged(this, EventArgs.Empty);
}
OnFeatureChanged();
}
finally
{
inDrawingChanged_ = false;
}
}
}
public Drawing Drawing {
get
{
return drawing_;
}
set
{
drawing_ = value;
OnDrawingChanged();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment