Using the Assembly.GetFile(string) method?

  • Thread starter Thread starter Kyle Kaitan
  • Start date Start date
K

Kyle Kaitan

I have the following code:
Assembly asm = Assembly.LoadFrom("Foo.dll");
foreach (string s in asm.GetManifestResourceNames())
{
Console.WriteLine("found manifest resource: " + s);
}

FileStream fs = asm.GetFile( ??? );
<<<<<

Suppose I have a resource file called "Xyz.resx" embedded in the Foo.dll
assembly above. (Xyz also shows up as one of the items on the WriteLine
output too.) What should replace the '???' to generate the FileStream
properly? I've tried everything I can think of and still no dice.

Any help would be appreciated. Thanks!
 
Assembly asm = Assembly.LoadFrom("Foo.dll");
foreach (string s in asm.GetManifestResourceNames())
{
Console.WriteLine("found manifest resource: " + s);
}

FileStream fs = asm.GetFile( ??? );
<<<<<

Suppose I have a resource file called "Xyz.resx" embedded in the Foo.dll
assembly above. (Xyz also shows up as one of the items on the WriteLine
output too.) What should replace the '???' to generate the FileStream
properly? I've tried everything I can think of and still no dice.

Use asm.GetManifestResourceStream - and it won't return a FileStream,
just a Stream.
 
Back
Top