You might be able to cobble something together with the System.InteropServices.Marshal class.
I don't see anything which works with byte arrays, but there's a Marshal.PtrToStructure() method which takes an IntPtr and a Type. You could probably get an IntPtr for your byte[] using the C# "fixed" keyword (as Ovidiu mentioned). Combine that with typeof(aMsg) and Marshal.PtrToStructure() should return an aMsg. Good luck, G. P.S. I'm getting very confused with all these Graemes on the list! :) -- The Original Graeme Foster ([EMAIL PROTECTED]) Principal Software Engineer Aston Broadcast Systems Ltd. (http://www.aston.tv) Disclaimer: I really don't have a clue what I'm on about. -----Original Message----- From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of Ovidiu Platon Sent: 29 May 2002 15:53 To: [EMAIL PROTECTED] Subject: Re: byte[] to Object As far as I know, you will have to write a C-like function in C# using unsafe code (check out the unsafe and fixed keywords) or, maybe better, maybe not, write unmanaged code in C and call it from C#. BTW, if you need to have the same interpretation of the bits, the DWORD is uint in .NET. 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 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++) (C#) struct aMsg struct aMsg { { DWORD a; int a; DWORD b; int b; DWORD c; int c; } } Then, the C++ structure is written in the socket, and then I receive the byte[] in C#. I want to do something like (so simple): byte[] received; aMsg myMsg=(aMsg)received; Is this possible? ***************************************************************************** The contents of this email and any attachments are confidential. It is intended for the named recipient(s) only. If you have received this email in error please notify the system manager or the sender immediately and do not disclose the contents to any one or make copies. ** eSafe scanned this email for viruses, vandals and malicious content ** ***************************************************************************** You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.