Lew,
There really isn't one. You could use the FieldOffset attribute, but
for really complex unions, you will probably have to do something custom.
I would look up the terms "union" and "FieldOffset" in groups.google.com
in order to see previous threads on this subject.
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
"Lew Barnesson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Nicholas,
>
> Thank you. Exactly what I needed.
>
> On another issue, do you have any counterpart for the C 'Union' construct
> in C#?
>
> - Lew
> "Nicholas Paldino [.NET/C# MVP]" <(E-Mail Removed)> wrote
> in message news:%23c%23$(E-Mail Removed)...
>> Lew,
>>
>> You can use the static ToInt16 method on the BitConverter class to do
>> this.
>>
>> Hope this helps.
>>
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> - (E-Mail Removed)
>>
>> "Lew Barnesson" <(E-Mail Removed)> wrote in message
>> news:b8-dnd-(E-Mail Removed)...
>>> Hi,
>>>
>>> I have a byte array read from a file using Stream IO, and containing a
>>> mixture of 16-bit integers, strings, etc..
>>>
>>> The problem: what is the best way to convert two byte sequences into
>>> 16-bit integers in a way similar to what I used to do with C or C++
>>> formatted IO?
>>>
>>> Is there really no direct way to accomplish this without my having to
>>> write my own formatted IO routines? Any help appreciated.
>>>
>>> Thanks.
>>>
>>> - Lew
>>>
>>
>>
>
>