So... I ended up with this code (now I'm looking how to convert a
StreamReader to a String using C#
But actually I don't remember it was so hard to obtain a string from a .txt
file embedded in a VB project. Am I wrong?
Assembly _assembly;
_assembly = Assembly.GetExecutingAssembly();
StreamReader _textStreamReader;
_textStreamReader = new
StreamReader(_assembly.GetManifestResourceStream("MyClassLibrary.MyFolder.MyFile.txt"));
> So... I ended up with this code (now I'm looking how to convert a
> StreamReader to a String using C#
[quoted text clipped - 6 lines]
> _textStreamReader = new
> StreamReader(_assembly.GetManifestResourceStream("MyClassLibrary.MyFolder.MyFile.txt"));
By the time you've put the assignments in the same statements as the
declarations, that's two (admittedly long) lines of code. If that's
*really* too much, you can put it into a helper method really easily.
As for converting a StreamReader to a String - StreamReader.ReadToEnd
is your friend :)

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Carlos Sosa Albert - 08 Jun 2007 14:47 GMT
Actually, I was sure I didn't have to specify "by hand" MyFile.txt but the
helper was doing so.
But maybe I wrote some code then to do that.
>> So... I ended up with this code (now I'm looking how to convert a
>> StreamReader to a String using C#
[quoted text clipped - 14 lines]
> As for converting a StreamReader to a String - StreamReader.ReadToEnd
> is your friend :)
Carlos Sosa Albert - 08 Jun 2007 14:59 GMT
Oh, I remember... I used this... Wonder if it has something wrong...?
String xx = MyLibrary.Properties.MyResource;
Thanks Jon!
>> So... I ended up with this code (now I'm looking how to convert a
>> StreamReader to a String using C#
[quoted text clipped - 14 lines]
> As for converting a StreamReader to a String - StreamReader.ReadToEnd
> is your friend :)