I am writing a simple Silverlight application and WCF Service.
I want to create a synchronous method that return a value.
The method itself, call an asynchronous method from WCF Services. After I call asynchronous method, I want to get it value, and return to sender.
I hear that Rx can solve this kind of problem.

This is my code :

    private void btnCreate_Click(object sender, RoutedEventArgs e)
    {
        string myResult = getMyBook(txtBookName.Text);
        MessageBox.Show("Result\n" + myResult);
        // myResult will be use for another purpose here..
    }

    // I want this method can be called anywhere, as long as the caller still in the same namespace.
    public string getMyBook(string bookName)
    {
        Servo.ServoClient svc = new ServoClient();
        string returnValue = "";

        var o = Observable.FromEventPattern&lt;GetBookCompletedEventArgs&gt;(svc, "GetBookCompleted");
        o.Subscribe(
            b =&gt; returnValue = b.EventArgs.Result
            );

        svc.GetBookAsync(bookName);
        return returnValue;
    }


When I click btnCreate, myResult variable still empty. Is that something wrong with my code? Or maybe I am just don't understand with Rx concept? I am new to Rx.

My goal is : I need to get the result (myResult variable) from asynchronous method, and then used in later code.


Question: Oracle: function only returning null
Answer: check below statement:

IF r_meeting%NOTFOUND THEN
        r_meeting.TITLE := 'UNKNOWN APPOINTMENT';
        END IF;

        CLOSE current_meeting;

        RETURN r_meeting.TITLE;
    END;