The method I would like to obtain is Observable.Return from System.Reactive.
It's defined like this:
public static IObservable<TResult> Return<TResult>(TResult value)
{
...
}
I've tried with
Type observableType = typeof(Observable);
MethodInfo returnMethodInfo = observableType.GetMethod("Return");
var genericMethodInfo = returnMethodInfo.MakeGenericMethod(typeof(int));
The problem is that I'm getting an error message:
Ambiguous match found.
I guess it's because there is another method called "Return":
public static IObservable<TResult> Return<TResult>(TResult value, IScheduler scheduler)
{
...
}
How should I call GetMethod
to get a MethodInfo
to the method I want?