开发者

OLEVariant to .Net byte[]

I have开发者_JAVA技巧 an OLEVariant disguised as a .Net object that I recieve from a client-side component over the net. I know that the contents are an array of bytes, but I don't know how to convert those contents to a native .Net byte array (byte[]). Any clues on how I can accomplish the conversion?

Edit: We answered our own question. To take an OleVariant (of type array of bytes) to a .Net byte[] requires pumping the object as it comes in into a .Net Array, taking the Array's upper bounds, creating a new byte[] of upperbound size and then finally doing an Array.Copy().


Cast the object to byte[] with (byte[])myobj or myobj as byte[] .

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜