title: Creating a hot observable and adding things to it
body: <p>I am trying to create a hot observable where I can add stuff to it. Here's an outline of the basic class</p>
  
  <pre><code>public class MyObservable
  {
      public IObservable&lt;string&gt; Stream;
  
      public MyObservable()
      {
           Observable.Create...?
      }
  
      public void AddString(string eventDescription)
      {
         //Add to Stream
      }
  }
  </code></pre>
  
  <p>Somewhere else in the code I want to be able to do something like</p>
  
  <pre><code>var ob = new MyObservable();
  MyObservable.Add("User created");
  </code></pre>
  
  <p>Then somewhere else something like:</p>
  
  <pre><code>ob.Stream.Subscribe(Console.WriteLine);
  </code></pre>
  
  <p>I am not really sure how I am supposed to add strings to the observable</p>
  
  <p>edit: I've tried doing something like this, but I'm not sure if maybe I'm not doing things in the way it's supposed to be done</p>
  
  <pre><code>    private IObserver&lt;string&gt; _observer;
  
      public void Add(string e)
      {
          if(Stream == null) 
          { 
              Stream = Observable.Create&lt;string&gt;(
                  (IObserver&lt;string&gt; observer) =&gt;
                  {
                      _observer = observer;
                      observer.OnNext(e);
                      return Disposable.Empty;
                  });
          }
          else
          {
                _observer.OnNext(e);
          } 
  
      }
  </code></pre>