c# - Why subscriptions interact with each other? -


I am experimenting with RX, and I've gone into the following problem (at least I think it's a problem I believe in). The following code makes a noticeable, and subscribe it twice. I thought the subscription should work independently , so the code below will be two lines on each key press, one for a subscription. But this is not the case, I always give a special key stroke, semi-randomly only one subscription to handle first or second. Why is this happening and what is the "recommended" way of doing it to many observers?

  Fixed IEnumerable & lt; ConsoleKeyInfo & gt; Keepers () {for (;;) {var currentKey = console Read (true); If breaking (currentKey.Key == ConsoleKey.Enter) yield; Turn yield yield; }} Fixed zero main () {var timeToStop = new manual reset event (wrong); Var keypresses = KeyPresses () ToObservable (); Keypresses Subscribe (key =>. Wrightite (key.Key + "1"), () => timeToStop.Set ()); Keypresses Subscribe (key =>. Wrightite (key.Key + "2"), () => timeToStop.Set ()); TimeToStop.WaitOne (); } The reason for this particular behavior was that  cool . Which means that each customer was consuming on ReadKey call .GetNext () As soon as I make a call, I get "hot" by looking at  
  var keypresses = KeyPresses (). ToObservable () Publish ();  

Each customer received their value.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -