首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在F#交互中使用Span?

如何在F#交互中使用Span?
EN

Stack Overflow用户
提问于 2018-10-30 17:47:14
回答 1查看 631关注 0票数 4

我试图添加对System.Memory的引用

代码语言:javascript
复制
#r "C:/Program Files/dotnet/shared/Microsoft.NETCore.App/2.1.5/System.Memory.dll"

但是F#互动仍然说The value or constructor 'Span' is not defined。当我尝试使用open System.Memory时,它说是The namespace 'Memory' is not defined。有办法这样做吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-10-31 00:34:59

您不需要open System.Memory,但是您需要open System。您还可能希望先将nuget System.Memory放入.NET框架应用程序中,然后引用它。我想知道FSI将如何与Span<T>交互。

代码语言:javascript
复制
#if INTERACTIVE
#r @"C:\Users\username\Documents\Source\ConsoleApplication1\packages\System.Memory.4.5.1\lib\netstandard2.0\System.Memory.dll"
#r "System.Runtime.dll"
#endif


open System
open System.Runtime.CompilerServices

[<IsByRefLike; Struct>]
type S(count1: Span<int>, count2: Span<int>) =
    member x.Count1 = count1
    member x.Count2 = count2  
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53070089

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档