Return Iobservable in a method

Asked

Viewed 87 times

0

I have a method that needs to return an Iobservable, but I’m having a lot of trouble. There is little content regarding this interface and what I find requires the use of the Reactive extension (https://docs.microsoft.com/en-us/previous-versions/dotnet/reactive-extensions/hh242985(v=vs.103)) Someone with knowledge regarding the Iobservable interface can confirm me if it is really only possible to return an Iobservable in a method with the use of that extension?

public class Graph<T> : IGraph<T>
{
    public Graph(IEnumerable<ILink<T>> links)
    {

    }

    public IObservable<IEnumerable<T>> RoutesBetween(T source, T target)
    {
        throw new NotImplementedException();
    }
}}
  • Tamara, this new Microsoft mania to translate everything is problematic... Did you see this example? How to implement an observer Iobservable<T> Interface

  • You installed the package System.Reactive.Linq ?

  • @Fabioin Hi Fabio. I came to see yes, but it didn’t help me much, unfortunately.

  • @Virgilionovic Hi Virgilio. I didn’t install it. Just to explain, I am doing a test for a company and the reference addition is blocked in the project and therefore I cannot install the package. So I would like to know if it is possible to return Iobservable without having to use Reactive.

  • Tamara does, because IObservable is a interface just implement a class and in return use the instance of that class

  • 1

    @Virgilionovic Virgilio Thanks! I hadn’t thought about it. I’ll try and let you know if it works

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.