static void ControlStreamsAddRemoveDemo(TwitterContext twitterCtx) { var evt = new ManualResetEventSlim(false); string streamID = string.Empty; Console.WriteLine("\nStreamed Content: \n"); int count = 0; (from strm in twitterCtx.UserStream where strm.Type == UserStreamType.Site && //strm.With == "followings" && strm.Follow == "15411837"/*, "16761255"*/ select strm) .StreamingCallback(strm => { if (strm.Status == TwitterErrorStatus.RequestProcessingException) { Console.WriteLine(strm.Error.ToString()); return; } Console.WriteLine(strm.Content + "\n"); var json = JsonMapper.ToObject(strm.Content); var jsonDict = json as IDictionary<string, JsonData>; if (jsonDict != null && jsonDict.ContainsKey("control")) { streamID = json["control"]["control_uri"].ToString().Replace("/1.1/site/c/", ""); evt.Set(); } if (count++ >= 10) { Console.WriteLine("Closing stream..."); strm.CloseStream(); } }) .SingleOrDefault(); evt.Wait(); Console.WriteLine("\nInitial Stream Users: "); PrintUserInfo(twitterCtx, streamID); ControlStream csAdd = twitterCtx.AddSiteStreamUser(new List<ulong> { 16761255 }, streamID); Console.WriteLine("Command Response: " + csAdd.CommandResponse); Console.WriteLine("\nAfter Adding a User: "******"Command Response: " + csRemove.CommandResponse); Console.WriteLine("\nAfter Removing a User: "); PrintUserInfo(twitterCtx, streamID); }