byte[]放入ViewSate Session
先用BinaryFormatter序列化成byte[],再存入viewState
int[,] ma = .......;
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
System.IO.MemoryStream ms = new System.IO.MemoryStream();
bf.Serialize( ms , ma);
ms.Seek( 0 , System.IO.SeekOrigin.Begin );
byte[] b = new byte[ ms.Length ];
ms.Read( b ,0 , b.Length );
ViewState["data"] = b;
用到的时候
byte[] b =(byte[]) ViewState["data"];
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
System.IO.MemoryStream ms = new System.IO.MemoryStream( b );
object o = bf.Deserialize( ms );
int[,] ma = .......;
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
System.IO.MemoryStream ms = new System.IO.MemoryStream();
bf.Serialize( ms , ma);
ms.Seek( 0 , System.IO.SeekOrigin.Begin );
byte[] b = new byte[ ms.Length ];
ms.Read( b ,0 , b.Length );
ViewState["data"] = b;
用到的时候
byte[] b =(byte[]) ViewState["data"];
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
System.IO.MemoryStream ms = new System.IO.MemoryStream( b );
object o = bf.Deserialize( ms );