This code reads an array of files and should pass them through to the following class library.
private void btnConvert_Click(object sender, EventArgs e)
{
if (rbtnNetIX.Checked == true)
{
string[] files = Directory.GetFiles(txtPath.Text, "*.txt");
NetEDI.NetIX.Seiko.Seiko.Main(files);
}
should be referenced by the following code.
public class Seiko
{
public void Main(string[] args)
{
List<FileDefinition.FileDefinition> fileDefs = new List<FileDefinition.FileDefinition>();
foreach (string fileEntries in args)
{
fileDefs.Add(CreateFileDef(fileEntries));
}
foreach (var fileDef in fileDefs)
{
XmlCreator CreateXmlDefinition = new XmlCreator(fileDef.FileName + ".xml", fileDef);
}
}
Look at your
Mainmethod declaration:That’s an instance method – you have to call it on an instance of
Seiko. But when you try to call it here:… you’re trying to call it as if it’s a static method.
Given the conventions around
Main, I strongly suspect you want to make it a static method.(As an aside, you should probably revise the difference between static and instance members, and have another look at the error message: see if you can work out why you didn’t figure the problem out yourself, so that next time you run into something similar, you can fix it.)