你能帮我检测一下丢失的指令(未找到扩展方法) [英] Can you help me detect missing directive (extension method not found)

查看:42
本文介绍了你能帮我检测一下丢失的指令(未找到扩展方法)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我开始使用rx扩展并下载了一些来源。

Hello, I am starting to play with rx extension and downloaded some sources.

基本示例工作正常,但是有一个函数导致错误显然是因为扩展方法未声明(应使用某些指令导入)

Basic examples works fine, however there is a function causing an error apparently because an extension method is not declared (should be imported with some directive)

导致错误的代码行是注释源中的第二行(list.Run)(我评论为能够编译):

The line of code causing the error is the 2nd one (list.Run) in the commented source (I commented to be able to compile):

   

   

< span style ="color:#00d0d0"> / *

    protected static void WriteListToConsole< T>(IEnumerable< T> list,string name){

    protected static void WriteListToConsole<T>(IEnumerable<T> list, string name) {

      list.Run(

      list.Run(

        value => Console.WriteLine(" {0}:{1}",name ,价值),

        value => Console.WriteLine("{0} : {1}", name, value),

       ()=> Console.WriteLine(" {0} Completed",name));

        () => Console.WriteLine("{0} Completed", name));

    }

    }

     * /

     */

看起来Rx定义了一个分机。方法运行到IEnumerable但我没有导入它。

it looks like Rx defines somewhere an ext. method Run to IEnumerable but I am not importing it.

我安装了Rx v2.0.3 SDK.msi,在我的项目中添加了对所有System.Reactive的引用。*我找到并使用了:

I installed Rx v2.0.3 SDK.msi , added references in my project to all System.Reactive.* I found  and used:

使用System;

使用System.Reactive.Subjects;

使用System.Reactive.Linq;

使用System.Collections .Generic;

使用System.Linq;

使用System.Text;

使用System.Threading.Tasks;

using System;
using System.Reactive.Subjects;
using System.Reactive.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

我也尝试在我的项目中使用Nuget.Main  rx包但错误始终存在。

I also tried use the Nuget.Main  rx package in my project but the error is always there.

在Google上搜索IEnumerable + Run没有给我任何信息。

Searching on google IEnumerable + Run gives me no info.

感谢任何帮助。

谢谢

推荐答案

我从未听说过 IEnumerable的 .RUN()。一个快速谷歌显示OpenXmlElement的东西,但这似乎不是你想要的。

I've never heard of IEnumerable.Run(). A quick google shows something with OpenXmlElement, but that doesn't seem to be what you are looking for.

根据你想做什么,你可以简单地转换为列表到RX可观察,并订阅它。

Judging by what you want to do, you can simply convert to list to a Rx Observable, and subscribe to it.

        protected static void WriteListToConsole<T>(IEnumerable<T> list, string name) {
            list.ToObservable().Subscribe(
              value => Console.WriteLine("{0} : {1}", name, value),
              () => Console.WriteLine("{0} Completed", name));
        }




还有一些Rx进口,


Also there are a few more Rx imports,

using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Reactive.Threading.Tasks;


但你只需要`System.Reactive.Linq`来访问`ToObservable()`。



but you will only really need `System.Reactive.Linq` to get access to `ToObservable()`.



这篇关于你能帮我检测一下丢失的指令(未找到扩展方法)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆