找不到 C# IReadOnlyDictionary

C# IReadOnlyDictionary cannot be found

我正在尝试使用 Kinect 检测 body 关节。我正在努力编译演示代码。我写的代码如下:

Joint head = body.Joints[JointType.Head];
float x = head.Position.X;
float y = head.Position.Y;
float z = head.Position.Z;

我从检测到的 body 帧中获取 body。问题是在使用关节时。

上面的代码给我以下错误:

错误 CS7069 对类型 'IReadOnlyDictionary<,>' 的引用声称它在 'mscorlib' 中定义,但找不到。

在 Internet 上找不到任何具体的内容。任何帮助表示赞赏。

查看 IReadOnlyDictionary<TKey,TValue> 的 MSDN 页面底部有一个 Version Information 部分

Version Information

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.5
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1

您的代码版本 运行 低于您正在构建的任何平台的最低支持版本。更新您的代码库以使用更新版本的框架,很可能来自 project properties window.