Is there a way to cast a System.Object
to byte*
?
views:
164answers:
4
A:
According to Jon Skeet, it is possible through just casting it to a byte array.
monksy
2009-12-02 22:31:23
I need cast to unsafe pointer. I ve made a workaround. Passing int through function. I can easily convert byte* to int and int to byte*.But still the question is here.
Michal Franc
2009-12-02 22:36:58
@steven i postet jon skets code above ;-)
streetparade
2009-12-02 22:41:03
After I posted the source.
monksy
2009-12-03 03:17:13
+2
A:
How about something like...
BinaryFormatter bf = new BinaryFormatter();
System.IO.MemoryStream ms = new System.IO.MemoryStream(1024);
Object1 blah = new Object1("Hello");
bf.Serialize(ms, blah);
byte[] bytes = ms.GetBuffer();
Germ
2009-12-02 22:42:35