开发者

Access Azure Embedded Binary Resource (FileStream?)

I have some code that uses FileStream to quickly read from a binary file. My test project console app works great pointing at a local file. My production environment is ASP.NET MVC on Azure, and so I figured that I should use a resource file. Currently the code is:

var file 开发者_开发问答= new FileStream(@"c:\path\myfile.dat", FileMode.Open, FileAccess.Read);

...

Do I need to migrate the code to use something other than FileStream, or is there a way? Speed is a key requirement.


Nevermind. This was easy. I simply needed to use MemoryStream instead.
var ms = new MemoryStream(MyAssembly.Properties.Resources.Resource, false);

MemoryStream and FileStream both inherit from Stream, so the rest of the code didn't have to change...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜