Re: [DOTNET] byte[] to Object

2002-06-05 Thread Wil Burton
Why don't you just make a constructor for aMsg that accepts byte[] as a parameter? In the constructor just read the byte array and initialize your variables. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develo

Re: [DOTNET] byte[] to Object

2002-06-01 Thread Rama Krishna
erguson [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 01, 2002 8:34 AM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] byte[] to Object Wouldn't this confuse the GC. It seems like the GC wouldn't 'know' what type the memory is. What if aMsg had a finalizer. Would the GC c

Re: [DOTNET] byte[] to Object

2002-06-01 Thread David Ferguson
n" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 29, 2002 12:19 PM Subject: Re: [DOTNET] byte[] to Object Try byte[] received; aMsg m; fixed (byte* pBuffer = received) { m = *((aMsg*) pBuffer); } -Original Message- From: Miguel Ángel Chacón

Re: [DOTNET] byte[] to Object

2002-05-29 Thread Graeme Foster
. Good luck, Ovidiu. -Original Message- From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of Miguel Ángel Chacón Sent: Wednesday, May 29, 2002 3:36 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] byte[] to Object Thanks, but maybe I don't explain it very well. I need to read th

Re: [DOTNET] byte[] to Object

2002-05-29 Thread Eric Gunnerson
Try byte[] received; aMsg m; fixed (byte* pBuffer = received) { m = *((aMsg*) pBuffer); } -Original Message- From: Miguel Ángel Chacón [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 29, 2002 5:36 AM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] byte[] to Object Thanks, but

Re: [DOTNET] byte[] to Object

2002-05-29 Thread Thomas Scheidegger
is IntPtr ptr = Marshal.UnsafeAddrOfPinnedArrayElement((Array)handle.Target,0); equivalent to: IntPtr ptr = handle.AddrOfPinnedObject(); or are there differences? I guess no. Thomas > -Original Message- > From: dotnet discussion [mailto:[EMAIL PROTECTED]] > On Behalf Of Rama Kris

Re: [DOTNET] byte[] to Object

2002-05-29 Thread Marsh, Drew
Miguel Ángel Chacón [mailto:[EMAIL PROTECTED]] wrote: > Thanks, but maybe I don't explain it very well. I need to > read the values written by another app, that is > Unmanaged(C++,VB), in a socket. I can't alter the way the > data is written, because is another app, but I know the > structure

Re: [DOTNET] byte[] to Object

2002-05-29 Thread Steve Johnson
> Thanks, but maybe I don't explain it very well. I need to read the > values written by another app, that is Unmanaged(C++,VB), in a socket. I > can't alter the way the data is written, because is another app, but I > know the structure of the data, just like: > (C++) (

Re: [DOTNET] byte[] to Object

2002-05-29 Thread Rama Krishna
>>byte[] received; >>aMsg myMsg=(aMsg)received; >>Is this possible? Actually here is how you do it, struct MyMessage { int x; int y; int z; int u;

Re: [DOTNET] byte[] to Object

2002-05-29 Thread Ovidiu Platon
luck, Ovidiu. -Original Message- From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of Miguel Ángel Chacón Sent: Wednesday, May 29, 2002 3:36 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] byte[] to Object Thanks, but maybe I don't explain it very well. I need to read the v

Re: [DOTNET] byte[] to Object

2002-05-29 Thread Miguel Ángel Chacón
de mayo de 2002 13:18 Para: [EMAIL PROTECTED] Asunto: Re: [DOTNET] byte[] to Object You might want to examine the section on Serialisation in MSDN. ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconbinaryserialization.htm Hope this helps, Graeme > -Original Message- > From: dotnet di

Re: [DOTNET] byte[] to Object

2002-05-29 Thread Graeme Humphrey
29 May 2002 10:48 > To: [EMAIL PROTECTED] > Subject: [DOTNET] byte[] to Object > > > I need to convert a byte[] received from a low-level socket connection > to an object, and then cast to a user-type object. Is this possible? How > can I do? > > Thanks a lot. > >

Re: [DOTNET] byte[] to Object

2002-05-29 Thread Pierre Greborio
--- -Original Message- From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of Miguel Ángel Chacón Sent: Wednesday, May 29, 2002 11:48 AM To: [EMAIL PROTECTED] Subject: [DOTNET] byte[] to Object I need to convert a byte[] received from a low-level socket connection to

[DOTNET] byte[] to Object

2002-05-29 Thread Miguel Ángel Chacón
I need to convert a byte[] received from a low-level socket connection to an object, and then cast to a user-type object. Is this possible? How can I do? Thanks a lot. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://disc

Re: [DOTNET] Byte[] to object

2002-05-23 Thread Marsh, Drew
Rolls, Robert [mailto:[EMAIL PROTECTED]] wrote: > I was hoping you didn't say that! looks as though I need copy > to another array as then assign to the object - the object is > sent via com interop to a third party library. Yup, in that case your only option is to put the contents into an array

Re: [DOTNET] Byte[] to object

2002-05-23 Thread Rolls, Robert
ECTED] Subject: Re: [DOTNET] Byte[] to object Rolls, Robert [mailto:[EMAIL PROTECTED]] wrote: > How do I limit the amount of bytes copied on the assignment? > or what can I > do to achieve the following - > > byte[] data = new byte[4096]; > int bytesread=0; > while((bytesread =

Re: [DOTNET] Byte[] to object

2002-05-23 Thread Marsh, Drew
Rolls, Robert [mailto:[EMAIL PROTECTED]] wrote: > How do I limit the amount of bytes copied on the assignment? > or what can I > do to achieve the following - > > byte[] data = new byte[4096]; > int bytesread=0; > while((bytesread = streamthing.read( data, 0, data.Length )) > 0 ) { > > //** The

[DOTNET] Byte[] to object

2002-05-23 Thread Rolls, Robert
How do I limit the amount of bytes copied on the assignment? or what can I do to achieve the following - byte[] data = new byte[4096]; int bytesread=0; while((bytesread = streamthing.read( data, 0, data.Length )) > 0 ) { //** The line below makes the oData have a length of 4096 when all I need