C# LINQ Syntax for Rx

    General discussion

  • Hi everyone,

    Thought it might be interesting to speculate on possible C# query comprehension syntax support for various Rx operators.

    I'll start with a few obvious ones.  (Although, I won't speculate as to their relative value, if any ;)

    Observable.Concat | Enumerable.Concat

    from x in xs
    select x
    concat from y in ys
    select y
    concat from z in zs
    select z;

    Observable.Zip | Enumerable.Zip

    from x in xs
    zip from y in ys
    select new { x, y }

    Observable.Take | Enumerable.Take

    from x in xs
    select x
    take 10


    from x in xs
    select x
    take until ys

    - Dave

    • Changed type Dave Sexton Friday, September 24, 2010 4:59 PM
    Wednesday, September 22, 2010 5:29 PM

All replies

  • Observable.CombineLatest

    from x in xs
    latest y in ys
    select new{x,y}

    I think it more likely that they will add some sort of "marco extensions" to query comprehension syntax.
    Wednesday, September 22, 2010 8:45 PM
  • Hi James,

    Hmm, macro extensions.  Not sure that I like the idea, unless it's implemented in such a way that an author is bounded by some reasonable constraints and standards.  Although, my opinion is biased since I haven't had any practical experience using macros (I don't know C++, for example).

    - Dave
    Thursday, September 23, 2010 12:56 AM
  • Driven as well by the biz-case "domain specific languages" i think a solution as described @ would fit the .net world quite well.


    Thursday, September 23, 2010 7:41 AM
  • Agree that this syntax would be nice.. maybe some feedback from external people in the form of a connect bug might make it show up on the radar of the C# team...
    Friday, September 24, 2010 4:45 PM
  • There was some video a while back on c9 from a guy at MS that was doing some interesting things with language extentions that would allow such things in an extendable way.  So you could do it yourself basically.  I will have to find that video as I have no clue on the keywords yet.
    Wednesday, October 6, 2010 10:44 PM