获取嵌入的资源

//获取文件流
     string name = MethodBase.GetCurrentMethod().DeclaringType.Namespace;

      Stream stream = Assembly.GetExecutingAssembly().
               GetManifestResourceStream(
                   name + ".update.txt")
//获取图片
        /// <summary>
        ///     获取当前命名空间下嵌入的资源图片
        /// </summary>
        /// <param name="imagePath">嵌入的图片资源的路径</param>
        private Image GetImageFormResourceStream(string imagePath)
        {
            string name = MethodBase.GetCurrentMethod().DeclaringType.Namespace;
            return Image.FromStream(
                Assembly.GetExecutingAssembly().
                    GetManifestResourceStream(
                        name + "." + imagePath));
        }
原文地址:https://www.cnblogs.com/sera/p/5387390.html