« How To: Obtain Method Name Programmatically For Tracing | Main | String Comparison Controversy »

How To: Return Emedded Resource Content as String

Here is a utility method for returning any embedded resource content as a string:

public static partial class Tools
{
    public static string GetEmbeddedContent(string resourceName)
    {
        Stream resourceStream =
            Assembly.GetAssembly(typeof(Tools)).GetManifestResourceStream(resourceName);
        StreamReader reader = new StreamReader(resourceStream);
        return reader.ReadToEnd();
    }        
}
Posted on Saturday, July 7, 2007 at 10:05AM by Registered CommenterJ. Michael Palermo IV in | CommentsPost a Comment

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.
Editor Permission Required
You must have editing permission for this entry in order to post comments.