// required
using System.IO;
using System.Reflection;
public string GetEmbeddedResource(string namespacename, string filename)
{
var assembly = Assembly.GetExecutingAssembly();
var resourceName = namespacename + "." + filename;
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
string result = reader.ReadToEnd();
return result;
}
}