编程语言
首页 > 编程语言> > c# – .Net标准项目:缺少System.Linq.Enumerable类

c# – .Net标准项目:缺少System.Linq.Enumerable类

作者:互联网

在.Net Standard 1.5项目中(1.6从nuget安装).

我不能使用驻留在System.Linq.Enumerable中的Linq的扩展方法.

喜欢Where,选择LIST上的方法< string>

我已经安装了以下包:

"System.Linq": "4.3.0",
"System.Linq.Expressions": "4.3.0",
"System.Linq.Queryable": "4.3.0",

更新

例:

using System.Linq;

List<string> myList = new List(); 
myList = // suppose list got data

myList.Where(  // Where is not available 

注意

无法访问包含Extension方法的System.Linq.Enumerable静态类.

更新2

{
  "supports": {},
  "dependencies": {
    "Chance.MvvmCross.Plugins.UserInteraction": "1.1.4",
    "Fody": "1.29.4",
    "MethodDecorator.Fody": "0.9.0.6",
    "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
    "MvvmCross": "4.3.0",
    "MvvmCross.Platform": "4.3.0",
    "NEST": "5.0.0",
    "NETStandard.Library": "1.6.1",
    "Newtonsoft.Json": "9.0.1",
    "PropertyChanged.Fody": "1.52.1",
    "System.Linq": "4.3.0",
    "System.Linq.Expressions": "4.3.0",
    "System.Linq.Queryable": "4.3.0",
    "System.ServiceModel": "1.0.0",
    "System.ServiceModel.Http": "4.3.0",
    "System.ServiceModel.Security": "4.3.0"
  },
  "frameworks": {
    "netstandard1.5": {
      "imports": "portable-net45+netcore45+wp8"
    }
  }
}

解决方法:

我有类似的问题,在project.lock.json中更改“修复”问题:

"System.Linq/4.3.0": {
..
        "compile": {
          "portable-net45+win8+wp8+wpa81/_._": {}
        },
..
      },

"System.Linq/4.3.0": {
..
        "compile": {
          "ref/netstandard1.0/System.Linq.dll": {}
        },
..
      },

几乎没有类似的部分.
这是解决方法而不是正确的解决方案

标签:c,linq,net-standard
来源: https://codeday.me/bug/20190710/1428885.html