Get File Bytes from Resource file in C#
问题 I used to store the resources in the actual project, but I've switched to using a resource file instead. Originally I could ready the bytes for a file, but I'm finding it difficult doing this with a resource file. Any suggestions would be greatly appreciated. 回答1: public static byte[] ReadResource(string resourceName) { using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) { byte[] buffer = new byte[1024]; using (MemoryStream ms = new MemoryStream()) {