Click here to Skip to main content
15,888,454 members
Home / Discussions / C#
   

C#

 
QuestionConditional Mathematical Statements Pin
Member 1226553728-Feb-16 21:39
Member 1226553728-Feb-16 21:39 
AnswerRe: Conditional Mathematical Statements Pin
Pete O'Hanlon28-Feb-16 22:08
mvePete O'Hanlon28-Feb-16 22:08 
AnswerRe: Conditional Mathematical Statements Pin
Sascha Lefèvre28-Feb-16 22:09
professionalSascha Lefèvre28-Feb-16 22:09 
Questionicon/image in datagridview Pin
Any_name_at_all28-Feb-16 1:52
Any_name_at_all28-Feb-16 1:52 
AnswerRe: icon/image in datagridview Pin
Dave Kreskowiak28-Feb-16 4:25
mveDave Kreskowiak28-Feb-16 4:25 
GeneralRe: icon/image in datagridview Pin
Any_name_at_all28-Feb-16 5:52
Any_name_at_all28-Feb-16 5:52 
QuestionHow does Observable.Join work? Pin
Kenneth Haugland27-Feb-16 18:38
mvaKenneth Haugland27-Feb-16 18:38 
AnswerRe: How does Observable.Join work? Pin
Kenneth Haugland28-Feb-16 12:15
mvaKenneth Haugland28-Feb-16 12:15 
After some testing I seem to have found my answer:
C#
var Interval_50ms = Observable.Interval(TimeSpan.FromMilliseconds(50))
    .Take(10);

var Interval_100ms = Observable.Interval(TimeSpan.FromMilliseconds(100))
    .Take(5)
    .Select(i => Convert.ToChar(i + 65).ToString().ToUpper());

var Result = Observable.Join(
    Interval_50ms,
    Interval_100ms,
    s => Observable.Never<Unit>(),
    c => Observable.Empty<Unit>(),
    (s, c) => { return s.ToString() + ", " + c.ToString(); })
    .Subscribe(Console.WriteLine);

The two streams seems to start arbitrary, I cant seem to get the lined up properly, as it sometimes it will start at 0, A and other times 1, A. I think that the stream that is an s => Observable.Never<Unit>() just tells the compiler to store all the values that has come as a number into an Observable<T>, and by setting the c => Observable.Empty<Unit> it will basically publish all values it has stored in s and combine these with the new single value that it found at c.
This was also a point that confused me, that the s and c will return singular value at the time, but can be of the stream type of Observable<T>. So when I get the result in (s, c) => ... they are of type <T>.

By using the type Observable.Empty<Unit> if told it to just get me the next new value. The code seem to say: once you get a new char into c, print all the values in s with the value c.

Trying to understand how to create the latest value of s with the next value of c was however a bit tricky:
C#
Observable.Join(
                Interval_50ms,
                Interval_100ms,
                s => Interval_50ms,
                c => Observable.Empty<char>(),
                (s, c) => { return s.ToString() + ", " + c.ToString(); })
                .Subscribe(Console.WriteLine);

This seem to produce some code that had some racing conditioning to it, so the results were a bit unstable.
SuggestionRe: How does Observable.Join work? Pin
John Torjo28-Feb-16 18:44
professionalJohn Torjo28-Feb-16 18:44 
GeneralRe: How does Observable.Join work? Pin
Kenneth Haugland28-Feb-16 19:13
mvaKenneth Haugland28-Feb-16 19:13 
GeneralRe: How does Observable.Join work? Pin
John Torjo28-Feb-16 19:17
professionalJohn Torjo28-Feb-16 19:17 
GeneralRe: How does Observable.Join work? Pin
Kenneth Haugland29-Feb-16 18:40
mvaKenneth Haugland29-Feb-16 18:40 
GeneralRe: How does Observable.Join work? Pin
John Torjo29-Feb-16 19:40
professionalJohn Torjo29-Feb-16 19:40 
QuestionGrid View Filtering Pin
Member 1235559027-Feb-16 3:07
Member 1235559027-Feb-16 3:07 
AnswerRe: Grid View Filtering Pin
Afzaal Ahmad Zeeshan27-Feb-16 4:09
professionalAfzaal Ahmad Zeeshan27-Feb-16 4:09 
Questionwhy password is not decrypting Pin
Veena Hosur25-Feb-16 23:13
Veena Hosur25-Feb-16 23:13 
AnswerRe: why password is not decrypting Pin
Richard MacCutchan26-Feb-16 0:20
mveRichard MacCutchan26-Feb-16 0:20 
GeneralRe: why password is not decrypting Pin
Veena Hosur26-Feb-16 0:52
Veena Hosur26-Feb-16 0:52 
GeneralRe: why password is not decrypting Pin
Richard MacCutchan26-Feb-16 0:55
mveRichard MacCutchan26-Feb-16 0:55 
GeneralRe: why password is not decrypting Pin
Nathan Minier26-Feb-16 1:25
professionalNathan Minier26-Feb-16 1:25 
GeneralRe: why password is not decrypting Pin
Sascha Lefèvre26-Feb-16 1:44
professionalSascha Lefèvre26-Feb-16 1:44 
AnswerRe: why password is not decrypting Pin
ZurdoDev26-Feb-16 4:01
professionalZurdoDev26-Feb-16 4:01 
GeneralRe: why password is not decrypting Pin
Richard MacCutchan26-Feb-16 6:18
mveRichard MacCutchan26-Feb-16 6:18 
GeneralRe: why password is not decrypting Pin
ZurdoDev26-Feb-16 6:23
professionalZurdoDev26-Feb-16 6:23 
GeneralRe: why password is not decrypting Pin
Richard MacCutchan26-Feb-16 6:41
mveRichard MacCutchan26-Feb-16 6:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.