0

My goal is to import a csv file into a data table, or the memory, and to also be able to export a data table into a csv file. For the import and the export, I'm trying to use a nugget package called CSVLibraryAK.Core and for some reason when I used the syntax that was provided by the creator of the nugget package, I still get an error. The error message is that, "the type or namespace name import doesn't exist in the namespace CSVLibraryAK.Core. I've tried to mess around with it and also tried to see if anyone else has encountered the same problem but I'm not getting anywhere.

This is some code that I have tried:

using CSVLibraryAK.Core;
using System.Data;
namespace project
{
    class Program
    {
        static void Main(string[] args)
        {
            bool hasHeader = true;
            string importFilePath = "C:\\import.csv";
            DataTable data = CSVLibraryAK.Core.Import(importFilePath, hasHeader);
        }
     }
} 

If anyone could help me out I'd be very grateful

  • 1
    Change `CSVLibraryAK.Core.Import` to `CSVLibraryAK.Core.CSVLibraryAK.Import`. – Prolog Jun 14 '22 at 18:33
  • 1
    Does this answer your question? [Type or namespace name does not exist](https://stackoverflow.com/questions/5567945/type-or-namespace-name-does-not-exist) – Prolog Jun 14 '22 at 18:35
  • @Prolog Thanks, that fixed it, but why did I have to write it out like that? – Aryan Gupta Jun 14 '22 at 19:23
  • Check out the [documentation](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0246) for this error causes and usual solutions. – Prolog Jun 14 '22 at 19:41
  • @Prolog Alright thanks, I didn't know they showed error causes, that's pretty cool. – Aryan Gupta Jun 15 '22 at 17:10

0 Answers0