gpt4 book ai didi

c# - 找不到 Rx Dump() 方法

转载 作者:行者123 更新时间:2023-12-02 20:31:47 25 4
gpt4 key购买 nike

我在这里以及其他网站上的各种帖子和教程中看到了很多答案,其中 Dump()方法用于 IObservable<T>顺序。但是,当我尝试使用它时,我得到 ... does not contain a definition for 'Dump' and no extension method for 'Dump' ... Cannot resolve symbol 'Dump'来自编译器的警告。它是否已从 Rx 中删除,或者我是否缺少库?

最佳答案

是的,我同意 LinqPad 中存在的评论,但是您可以编写自己的评论,如 http://www.introtorx.com/content/v1.0.10621.0/07_Aggregation.html 中所示。

public static class SampleExtentions
{
public static void Dump<T>(this IObservable<T> source, string name)
{
source.Subscribe(
i=>Console.WriteLine("{0}-->{1}", name, i),
ex=>Console.WriteLine("{0} failed-->{1}", name, ex.Message),
()=>Console.WriteLine("{0} completed", name));
}
}

关于c# - 找不到 Rx Dump() 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48443568/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com