.Net Reflector compilation errors

4

I'm studying C # and am trying to learn a bit of reverse engineering.

I have the following error:

private void button1_Click(object sender, EventArgs e)
{
    this.Result = true;
    this.ConfigName = this.textBox1.Text;
    string sourceFileName = new string[] { Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Tibia", this.BaseName }.Aggregate<string>(new Func<string, string, string>(Path.Combine));
    string destFileName = new string[] { Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Tibia", this.ConfigName }.Aggregate<string>(new Func<string, string, string>(Path.Combine));
    File.Copy(sourceFileName, destFileName);
    base.Close();
}

Displays the following error:

  

Error CS0246 The type or namespace name 'Func' could not be found (are you missing a directive or an assembly reference?)

In another section of the code

ConfigFinder.FindConfigs((ConfigFinder.ConfigListHandler) (arr => base.Invoke(() => configcombo.Items.AddRange(arr))));

He introduces me:

  

Error CS1660 Can not convert lambda expression to type 'Delegate' because it

And still in code

private void button1_Click(object sender, EventArgs e)
{
    this.Result = true;
    this.ConfigName = this.textBox1.Text;
    string sourceFileName = new string[] { Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Tibia", this.BaseName }.Aggregate<string>(new Func<string, string, string>(Path.Combine));
    string destFileName = new string[] { Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Tibia", this.ConfigName }.Aggregate<string>(new Func<string, string, string>(Path.Combine));
    File.Copy(sourceFileName, destFileName);
    base.Close();
}

displays the error:

  

Error CS1061 'string []' does not contain a definition for 'Aggregate' and no extension method 'Aggregate' accepting the first argument of type 'string []' could be found reference?)

What can it be?

    
asked by anonymous 15.09.2015 / 09:37

1 answer

2

Well, that's 3 different questions.

The first is because you did not import the namespace where the delegate is Func .

using System;

The CS1660 error is probably because the FindConfigs does not accept a delegate as a parameter.

The last error is because, again, you did not import the namespace of the Aggregate

using System.Linq;
    
15.09.2015 / 10:35