Reputation: 16226
I have a bunch of files in a directory:
Class1.ascx : contains class Class1
Class2.ascx : contains class Class2
I have a list of the file names, and I want to take each filename and identify the corresponding class.
foreach(var fileName in listOfFileNames)
{
...
Type t = MagicMethod(fileName)
...
}
Anyone know what MagicMethod would look like or if it is even possible to do?
Upvotes: 0
Views: 336
Reputation: 58293
The filename could be different than the classname. The file may not even contain a class.
You would have to parse the file.
Upvotes: 6