[Mono-list] Resource Question

Loren Bandiera lorenb at mmgsecurity.com
Tue Oct 24 11:39:32 EDT 2006


Hi,

There might be an easier way but I believe you can do it like this:

using System.IO;
using System.Reflection;

Assembly asm = Assembly.GetExecutingAssembly();
StreamReader sr = new StreamReader
(asm.GetManifestResourceStream("foo.txt"));


On Tue, 2006-10-24 at 11:28 -0400, Rodney J. Dyer wrote:
> I'm using monodev and I have imported a text file into the resources
> (say it is file.txt).  Now, I want to load the contents of that file
> into a string and I'm at a loss as to how to go about that.  The
> System.ResourceReader cannot find a resource named "file.txt" and a
> regular old file will not get it either.  Aren't the resources
> compiled
> into the app?  How do I get it? 
-- 
Loren Bandiera <lorenb at mmgsecurity.com>
MMG Security, Inc.



More information about the Mono-list mailing list