473,396 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using the Assembly.GetFile(string) method?

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!
Nov 16 '05 #1
1 7812
<"Kyle Kaitan" <kkaitan [at] gmail [dot] com>> wrote:
>>

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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sebastien Degardin | last post by:
Hello, I need to use a Factory pattern to create services class. i have an interface --> MyService i can have an abstract class --> MyAbstractService i have several concrete class for this...
0
by: mike | last post by:
Hi I am trying to find a tool that shows a dependency tree for method calls from an assembly. If the method call chain goes across assemblies, this would also be shown I have looked at dependency...
1
by: Matt | last post by:
In test() method: var path="C:\test\hello.txt"; //returns -1 for path.lastIndexOf("\\"). why?? var pos=path.lastIndexOf("\\"); //return -1 But in showFile() method: We are able to get the...
1
by: Prasad Dabak | last post by:
Hello, I have a legacy unmanaged application that returns property=value pairs separated by chr(252)and I am trying to parse this output from C# using string.split method. This works fine as...
3
by: Jonay Aloat | last post by:
I need to implement the following. Shoul I use multimap or write a string hash class? ie Brand Product ========================== Samson ...
7
by: james | last post by:
Hi, I am trying to insert a record into a database table, one field of which is a byte array. Using the below: Byte imgArr; .... <code to put image into imgArr>
2
by: yesh81 | last post by:
Hi , can anybody write a java program to validate IP Addresses using string tokenizer.
3
by: Navdip | last post by:
i want to create a DHTML page in which i want to create a Table using method in JSCRIPT in which i'll pass the number of rows and coloumns as arguments of method. and table should get created when...
4
by: Dev | last post by:
Can replacing this with stringbuilder advisable. Or since iteration is less only 20 times, the time taken by using strings and string builder will be the same. for( int i = 0; i< 20; i++ ) { ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.