That's what I though. As I said, I mapped the main one I've been concerned with to a [Flags] enum, and that seems to approximate the bit fields, making it more natural to twiddle the bits since they can be get/set by name instead of number.
Oh well, many thanks for the quick reply. Chris -----Original Message----- From: Peter Golde [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 08, 2002 7:16 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] MarshalAs on bit boundaries No, MarshalAs cannot be used to do bitfields. You have to do the bit twiddling yourself to set and get the bitfield. It's easiest to encapsulate it inside a property. -----Original Message----- From: Chris Szurgot [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 08, 2002 2:36 PM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] MarshalAs on bit boundaries I'm trying to do some interop with Win32 Comm handling, and at least one of the structures has fields that align on bit boundaries. Is there a way to do this in StructLayout.Explicit? I've been able to fake it out a little by using a [Flags] enum, but that doesn't work in the case of a two bit field. Many thanks, Chris You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
