数组和datatable间的相互转换[C#]

 byte[] LogMsgByte = null;    

                DataTable dtMessageInfo = new DataTable();

 

                //将datatable转换为数组               

                dtMessageInfo.TableName = "MSGInfoName";
                MemoryStream streamSaveUldByte = new MemoryStream();
                dtMessageInfo.WriteXml(streamSaveUldByte, XmlWriteMode.WriteSchema);
                LogMsgByte = streamSaveUldByte.ToArray();

 

                //将数组转换为datatable
                MemoryStream stream = new MemoryStream(LogMsgByte);
                dtMessageInfo.ReadXml(stream);

posted @ 2017-02-09 16:20  清空回声  阅读(1771)  评论(0编辑  收藏  举报