decrypted

decrypted decrypted

Niner since 2011

Comments

  • Rx Workshop: Observables versus Events

    Guess I'm late to the posts, but I think it can be simplified no?

    private Action<string> LengthHandler;
    
            public event Action<int> LengthChanged
            {
                add
                {
                    if (LengthHandler == null)
                        LengthHandler = text => value(text.Length);
                    TextChanged += LengthHandler;
                }
                remove
                {
                    TextChanged -= LengthHandler;
                }
    
            }

     

    and

     

    public IObservable<int> LengthChanged { get { return textChanged.Select(x => x.Length); } }