Carlos
Fri Jun 08 08:47:07 CDT 2007
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.
"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.20d28b64f0a746931d8@msnews.microsoft.com...
> <"Carlos Sosa Albert" <betun (at) hotmail>> wrote:
>> 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"));
>
> 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 :)
>
> --
> 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