Skip to content

Instantly share code, notes, and snippets.

@devknoll
Last active December 11, 2015 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devknoll/4530731 to your computer and use it in GitHub Desktop.
Save devknoll/4530731 to your computer and use it in GitHub Desktop.
var type = Class.New(new[] { typeof(ReactiveScreen), typeof(IHasState) }, cls => // Inherit from ReactiveScreen and implement IHasState.
{
var state = cls.Field<IObservable<string>>(); // Default to null.
cls.Property<IObservable<string>>(Modifier.Public, "State")
.Get(Modifier.Public, () => state.Get())
.Set(Modifier.Private, (value) => state.Set(value)); // TODO: INotifyPropertyChanged support...
cls.Function(Modifier.Public, "GetRandomNumber", () => 4); // Chosen by a fair dice roll. Guaranteed to be random.
});
Activator.CreateInstance(type);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment