-1

A little green when it comes to C# so I would really appreciate some help on this. I keep getting this error on this part of my code.

Error 1 The best overloaded method match for 'FileHelpers.FileHelperEngine.ReadString(string)' has some invalid arguments C:\Users\Traci\Documents\Visual Studio 2013\Projects\SpectraMX\src\SpectraMX.app\Program.cs 26 45 SpectraMX.app

static void Main(string[] args)
    {
        //get data from my ftp site
        string data = getDataFromFtpSite();

        //go through the records there
        FileHelperEngine <FtpProductRecord> engine = new FileHelperEngine<FtpProductRecord>();

        FtpProductRecord[] FtpRecords = engine.ReadString(getDataFromFtpSite);

        //for record requested below, write it

        foreach (var product in FtpRecords)
        {
            Console.WriteLine(product._UPC);
        }

The second error I get is:

Error 2 Argument 1: cannot convert from 'method group' to 'string' C:\Users\Traci\Documents\Visual Studio 2013\Projects\SpectraMX\src\SpectraMX.app\Program.cs 26 63 SpectraMX.app

When I run without debugging as is, I'm getting ALL of the data in the text file instead of just the UPC portion of it I requested. My data is separated by a semicolon in the text file and I have it shown as [FileHelpers.DelimitedRecord(";")]. Ive looked this up on FileHelpers and it looks to me like Im doing it right. http://www.filehelpers.net/quickstart/ A little help would be much appreciated.

Marcos Meli
  • 3,468
  • 24
  • 29
traci
  • 1
  • 4
  • http://stackoverflow.com/questions/729642/int-to-string-cannot-convert-from-method-group-to-string I hope this is link should be referred – Mahesh Malpani Jun 22 '15 at 04:33
  • I have made the change and it still does not work, Now im getting a handling exception error. FtpProductRecord[] FtpRecords = engine.ReadString getDataFromFtpSite(); – traci Jun 22 '15 at 04:56
  • now throwing another WARNING: 1 A reference was created to embedded interop assembly 'c:\Users\Traci\Documents\Visual Studio 2013\Projects\SpectraMX\packages\FileHelpers-Stable.2.9.9\lib\4.0\Interop.Excel.dll' because of an indirect reference to that assembly created by assembly 'c:\Users\Traci\Documents\Visual Studio 2013\Projects\SpectraMX\packages\FileHelpers-Stable.2.9.9\lib\4.0\FileHelpers.ExcelStorage.dll'. Consider changing the 'Embed Interop Types' property on either assembly. C:\Users\Traci\Documents\Visual Studio 2013\Projects\SpectraMX\src\SpectraMX.app\CSC SpectraMX.app – traci Jun 22 '15 at 21:39
  • Please [edit](http://stackoverflow.com/posts/30972132/edit) your post to include the **full** error message **including the stack trace**. – Dour High Arch Aug 05 '15 at 00:27

1 Answers1

0

You must use data in the ReadString method:

    //get data from my ftp site
    string data = getDataFromFtpSite();

    //go through the records there
    var engine = new FileHelperEngine<FtpProductRecord>();

    var FtpRecords = engine.ReadString(data);

    //for record requested below, write it

    foreach (var product in FtpRecords)
    {
        Console.WriteLine(product._UPC);
    }

I recommend to update to last version of the library at

http://www.filehelpers.net/download/

Marcos Meli
  • 3,468
  • 24
  • 29