How can I store a byte[] list in viewstate?
问题 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