Sunday, April 24, 2011

FRP and Rx

















The sample program is following:

var obs1 = Observable.FromEvent<TextChangedEventArgs>(textBox1, "TextChanged").Select(x => ((TextBox)x.Sender).Text);
var obs2 = Observable.FromEvent<TextChangedEventArgs>(textBox2, "TextChanged").Select(x => ((TextBox)x.Sender).Text);

var obs3 = obs1.Zip(obs2, (x, y) => x + y);
obs3.Subscribe(x => {
  textBox3.Text = x;
});

I recognize that (x, y) => x + y implies TextBox3.Text = TextBox1.Text + TextBox2.Text and Zip method implies time merging.

No comments:

Post a Comment