简体   繁体   English

您知道一个很好的F#和C#互操作示例吗?

[英]Do you know of a good F# and C# interop example available?

I am going to write a C# WinForms application which will run a long data-crunching task in a BackgroundWorker, show progress in a ProgressBar and have buttons to start, pause, resume and cancel the operation. 我将编写一个C#WinForms应用程序,该应用程序将在BackgroundWorker中运行一个长数据处理任务,在ProgressBar中显示进度,并具有用于启动,暂停,恢复和取消操作的按钮。 I'd like to write the calculation in F#. 我想用F#编写计算。 Do you know of any good examples or readings available in the Web which can help me? 您是否知道网络上有任何可以帮助我的好的例子或读物?

Luke Hoban in F# team has a video at PDC 2009. There is a concurrent image downloader using asynchronous programming, which does not block GUI thread. F#团队的Luke Hoban在PDC 2009上有一个视频 。有一个使用异步编程的并发图像下载器,它不会阻塞GUI线程。 This example also illustrates how to use C#(GUI) to call F# module(the image downloader). 此示例还说明了如何使用C#(GUI)调用F#模块(图像下载器)。

The example is at the second half of the video. 该示例在视频的后半部分。

You might also find this article helpful. 您可能还会发现本文很有帮助。


Edit: I realize the article I'm pointing at is all F# (not really using interop) but it does demonstrate parallel programming with F# so it does seem appropriate to the question. 编辑:我意识到我要指向的文章都是F#(不是真的使用互操作),但是它确实演示了使用F#进行并行编程,因此似乎确实适合该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM