Note that there are some explanatory texts on larger screens.

plurals
  1. POObservable<string> updated events?
    primarykey
    data
    text
    <p>I'm just trying to do a simple event handler on a string variable, so that if the string changes, it will do a Console.WriteLine (using the new Reactive library from MS (Rx)) </p> <p>The issue that I have is that it will display the first bit when I instantiate the class ("RandomGuid : Mine?"), but after that, none of the stuff I change afterwards spits anything out to the console.</p> <p>I went through the HOL from the MS website, but it goes straight from defining the Observable into reading values from a textbox, when all I want to do is watch whether a string was changed.</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MynahBirds { class Program { static void Main(string[] args) { List&lt;Minah&gt; minahs = new List&lt;Minah&gt;(); for (int i = 0; i &lt; 10; i++) { minahs.Add(new Minah()); } foreach (var item in minahs) { item.peers = minahs; } minahs.ForEach(m =&gt; m.s = Observable.Return&lt;string&gt;("Mine")); minahs.ForEach(m =&gt; m.s = Observable.Return&lt;string&gt;("Whee")); minahs.ForEach(m =&gt; m.s = Observable.Return&lt;string&gt;("Argh")); Console.ReadLine(); } } class Minah { Guid Id; public List&lt;Minah&gt; peers; IDisposable subscription; public IObservable&lt;string&gt; s = Observable.Return&lt;string&gt;("Mine?"); public Minah() { try { this.Id = Guid.NewGuid(); subscription = s.Subscribe((string a) =&gt; { Console.WriteLine("{0} : {1}", this.Id, a); }, (Exception ex) =&gt; { Console.WriteLine("Error {0} hit", ex.ToString()); }, () =&gt; { }); } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.ReadLine(); throw; } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload