XML and resource

  • Thread starter Thread starter Perspolis
  • Start date Start date
P

Perspolis

Hi all
I included some xml files to my project as resource...How can I load them at
run time??
thx
 
Hi, this can be done with the ResourceManager Class. There are tons of
examples available in Internet and
also some very good in the MSDN Library...


Best Regards

Kerem Gümrükcü
 
Hello,
I included some xml files to my project as resource...How can I load
them at
run time??

In Project-Explorer click on the xml file and set (under properties)
Buildaction="Embedded ressource".
So the file will be embedded in the assembly.
The call at runtime is i.e. :
Assembly thisExe = Assembly.GetExecutingAssembly(­);
Stream file=
thisExe.GetManifestResourceStr­eam("myAssemblyName.myXmlFile.xml");
textBoxXML.AppendText(new StreamReader(file).ReadToEnd()­);
file.Close();

In some cases the StreamReader.Read should be with Encoding.Default.


ciao Frank
 
thx Frank
good description..
if I want to load it from a dll resource ,Do I have to act this way??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top