static void Main()
{
//--- 初期値はDoを通らず、かつSubscribe時に流れる
var sequence = Observable.Range(1, 3)
.Do(value => Console.WriteLine("Do({0})", value))
.Publish(-1); //--- 初期値を指定
sequence.SubscribeTracer("A");
sequence.SubscribeTracer("B");
sequence.Connect();
sequence.SubscribeTracer("C");
}
//----- 結果
/*
----- A : Subscribe Before -----
A : OnNext(-1)
----- A : Subscribe After -----
----- B : Subscribe Before -----
B : OnNext(-1)
----- B : Subscribe After -----
Do(1)
A : OnNext(1)
B : OnNext(1)
Do(2)
A : OnNext(2)
B : OnNext(2)
Do(3)
A : OnNext(3)
B : OnNext(3)
A : OnCompleted
B : OnCompleted
----- C : Subscribe Before -----
C : OnCompleted
----- C : Subscribe After -----
*/