Re: Help With Project Please
Here's a constructor definition:
Constructor()
Here's a method definition that returns something:
string Method()
Here's a method definition that returns nothing:
void Method()
So we can see that the compiler uses a logic like "if there is a word before the method/constructor name that is a Type, like 'string' or 'void' then it is a method, if there is no word (because constructors don't return anything of any type), then it is a constructor
Using this info, can you work out what's wrong with your code?
Code:
private static Main(string dirPath)
Hints:
From the error message, it's clear to see tha tthe compiler thinks your line of code above is a constructor (when it actually needs to be a method) - can you work out why
You may find your main needs a string array as a parameter
Re: Help With Project Please
Any method that has the same name as the class in which it is contained is considered by the compiler to be a constructor.
Since your class does not specify any access modifiers and it's only method is static, the compiler assumes the class is also static.
Static constructors are constrained by the language specification to not have any access modifiers or parameters, this is why you are getting these errors.
A Console program is required to have a Main method as the program entry point, therefore you can't rename it. Rename your class (change it to something other than Main) and the problem will go away.