Galen.Ci.EntityFramework.Utilities.ResourceHelper.ReadBytes C# (CSharp) Method

ReadBytes() public static method

public static ReadBytes ( string resourcePath ) : byte[]
resourcePath string
return byte[]
        public static byte[] ReadBytes(string resourcePath)
        {
            const int bufferSize = 8192;
            var result = new List<byte>();
            var buffer = new byte[bufferSize];

            using (var stream = Assembly.GetCallingAssembly().GetManifestResourceStream(resourcePath))
            {
                int bytesRead;
                while ((bytesRead = stream.Read(buffer, 0, bufferSize)) > 0)
                {
                    result.AddRange(buffer.Take(bytesRead));
                }
            }

            return result.ToArray();
        }
    }