在哪里可以找到新的Span< T> ;? [英] Where do I find the new Span<T>?
问题描述
每个人都在写关于新型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):
- 转到NuGet软件包管理器
- 由Microsoft搜索System.Memory软件包并安装它.
现在您将可以使用Span<T>
.
无需再搜索预发行版本.
No need to search for pre-release versions anymore.
这篇关于在哪里可以找到新的Span< T> ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!