AssemblyAsResourceDemo.Program.LoadResource C# (CSharp) Method

LoadResource() static private method

static private LoadResource ( string name ) : byte[]
name string
return byte[]
        static byte[] LoadResource(string name)
        {
            var asm = typeof(Program).Assembly;
            using (var stream = asm.GetManifestResourceStream("AssemblyAsResourceDemo.Resources." + name))
            {
                byte[] buf = new byte[(int)stream.Length];
                stream.Read(buf, 0, buf.Length);
                return buf;
            }
        }