在哪里可以找到新的Span< T&gt ;? [英] Where do I find the new Span<T>?

查看:92
本文介绍了在哪里可以找到新的Span< T&gt ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个人都在写关于新型Span<T>有多强大的信息,所以我急切地想开始在我的库中重写几个方法,但是我在哪里真正找到它?我已将Visual Studio 2017更新到最新版本15.5.0,其中更改日志显示:

Everyone is writing about how great the new type Span<T> is so I eagerly wanted to start rewriting a couple of methods in my libraries but where do I actually find it? I've updated Visual Studio 2017 to the latest version 15.5.0 where the change-log says:

C#编译器现在支持7.2种语言功能,包括:

The C# compiler now supports the 7.2 set of language features including:

  • 通过ref struct修饰符支持在整个Kestrel和CoreFX中使用的Span<T>类型.

但是当我尝试使用它时,我的代码却出现错误,而intellisense无法解决它.这是一个.net 4.6.2项目,语言版本设置为最新的次要.

but when I try to use it my code I'm getting an error and intellisense cannot resolve it. It's a .net 4.6.2 project and the language version is set to latest minor.

我是否需要安装一些NuGet软件包才能使用它?我无法弄清楚.

Do I need to install some NuGet package in order to be able to use it? I can't figure this out.

推荐答案

Visual Studio 2019:如果您使用的是完整的.NET Framework(例如4.7.2):

Visual Studio 2019: If you are using the full .NET Framework (e.g. 4.7.2):

  1. 转到NuGet软件包管理器
  2. 由Microsoft搜索System.Memory软件包并安装它.

现在您将可以使用Span<T>.

无需再搜索预发行版本.

No need to search for pre-release versions anymore.

这篇关于在哪里可以找到新的Span&lt; T&gt ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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