Reflection in a console App?

  • Thread starter Thread starter G. Dean Blake
  • Start date Start date
G

G. Dean Blake

FileReader = New
StreamReader(System.Reflection.Assembly.GetEntryAssembly.GetManifestResource
Stream(ResourceName))

Works just fine in a Windows Application - it reads the resource file I have
in my project.

But the same thing won't work in a console application. it gets a
system.ArgumentNullExcepton.

Why? How can I read a resource in a console application?
Thanks,
G
 
G. Dean Blake said:
FileReader = New
StreamReader(System.Reflection.Assembly.GetEntryAssembly.GetManifestResource
Stream(ResourceName))

Works just fine in a Windows Application - it reads the resource file I have
in my project.

But the same thing won't work in a console application. it gets a
system.ArgumentNullExcepton.

Why? How can I read a resource in a console application?

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

It should work just fine, assuming you've got the right resource name.
 
Well, I worked up an example to show you and my example worked.

So, uh, never mind :)
G
 
Back
Top