简体   繁体   中英

can't import Linq using “using System.Linq;” in C#

I have imported external website into visual studio 2015. I am using .net 4.8. I am having trouble to import system.linq. It is saying "the type or namespace does not exist in the namespace system". I dont know Why does it not exist even I am using .net 4.8.

I have also tried to update to visual studio 2019 but same error occurs

using DAL;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;   /// here error is showing
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text.RegularExpressions;
using CsvHelper;
using System.Text;

the type or namespace does not exist in the namespace system

The System.Linq namespace is in the System.Core assembly (in System.Core.dll). So, it is needed to put system.core.dll in references.

you have to Add System.Linq dll to your project

do this:

  1. right click on References in your project from solution explorer
  2. click on Manage NuGet Packages
  3. search System.Linq then click on Install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM