How can I store a byte[] list in viewstate?

删除回忆录丶 提交于 2019-12-11 05:26:16

问题


I want to store some byte[] to ViewState. For example I want to store a list of FileBytes. How can I do it?


回答1:


I haven't actually tried this with a list, but it should be pretty simple:

List<byte> myByteList;
// do something here to load list
ViewState["Bytes"] = myByteList

When you need to get it out:

List<byte> myByteList = (List<byte>)ViewState["Bytes"];

Edit: Changed from byte[] to List.



来源:https://stackoverflow.com/questions/4915206/how-can-i-store-a-byte-list-in-viewstate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!