.Net Standard project : System.Linq.Enumerable class missing

1.8k views Asked by At

In .Net Standard 1.5 project(1.6 is installed from nuget).

I cannot use Extension methods of Linq that resides in System.Linq.Enumerable.

like Where, Select methods on LIST<string>

I have already installed below packages:

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

Update

Example:

using System.Linq;

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

myList.Where(  // Where is not available 

Note

System.Linq.Enumerable static class containing Extension methods are not accessible.

Update 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"
    }
  }
}
2

There are 2 answers

0
Irshad Ali On

I forgot this question, the issue was resolved by adding a package that needs System.Linq dll. Unfortunately, I don't remember the package name and I have no longer access to that project. But any body facing such issue may try some packages that starts with System.Linq.*

0
Zbyszek P On

I had similar problem, following change in project.lock.json "fix" the problem:

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

with

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

There are few similar sections. It is rather workaround than proper solution