导航

photo型的object转byte[]

Posted on 2017-03-29 17:41  颍川小哥  阅读(96)  评论(0编辑  收藏  举报
IEnumerable en = (IEnumerable) myObject;
byte[] myBytes = en.OfType<byte>().ToArray();




TypeConverter objConverter = TypeDescriptor.GetConverter(objMsg.GetType());
    byte[] data = (byte[])objConverter.ConvertTo(objMsg, typeof(byte[]));