Exemple #1
0
        public void Demo3()
        {
            var namesToLook = new Subject <string>();

            namesToLook.Select(partialName => _userSearchService.FindUser(partialName))
            .Switch()
            .Subscribe(users => { Console.WriteLine(string.Join(",", users.Select(p => p.Login))); });

            Console.ReadKey();
            namesToLook.OnNext("a");
            Console.ReadKey();
            namesToLook.OnNext("b");
            Console.ReadKey();
            namesToLook.OnNext("c");
            Console.WriteLine("done!");
            Console.ReadKey();
        }
Exemple #2
0
 private static IObservable <UserResponse> GetUser(UserQuery query)
 {
     Console.WriteLine("Got UserQuery({0}), Id = {1}", query.Name, query.Id);
     return(_userService.FindUser(query.Name)
            .Select(u => new UserResponse(query.Id, u.ToList())));
 }