Get a TextReader from a Stream?

Juan picture Juan · Mar 17, 2011 · Viewed 64.3k times · Source

I'm trying to read an embedded text file with System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resource); but it gives me a Stream. The embedded resource is a text file so, how can I turn this Stream into a TextReader?

Answer

Teo Klestrup Röijezon picture Teo Klestrup Röijezon · Mar 17, 2011
TextReader tr = new StreamReader(stream);