Unions - preCharge Forums
It shows that you are unregistered. Please register with us by clicking Here
preCharge Forums


Nav Green LeftNav Right
preCharge Forums > Website Design & Development > Programming > .NET » Unions


Reply
Tcat Right
 
LinkBack Thread Tools Display Modes Tcat Right
Old 07-06-2006   #1 (permalink)
Tom Tom
Junior Member
 
Join Date: Jul 2006
Age: 48
Posts: 25
Default Unions

can you use unions in C#?
Tom Tom is offline   Reply With Quote


Old 07-07-2006   #2 (permalink)
AddCoderPro
Junior Member
 
Join Date: Jul 2006
Age: 28
Posts: 15
Default

There is no union in C# nor in VB.NET but union but you can use the FieldOffset attribute to have a memory represenation: here is a sample hack to use union:
Unions in C#

--
[StructLayout(LayoutKind.Explicit)]
public struct MyUnionWithCategories
{
[FieldOffset(0)] public int Category;
[FieldOffset(0)] public char CategoryRep;
[FieldOffset(0)] public long CategoryIndicator;
}
--
AddCoderPro is offline   Reply With Quote

Reply



Currently Active Users Viewing This Thread: 3 (0 members and 3 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


footer left
All times are GMT. The time now is 10:13 PM.

DISCLAIMER: preCharge Risk Management is not responsible for any opinions, advice or comments expressed on the preCharge Community Forums.
preCharge® is a registered trademark of preCharge Risk Management | chargeback protection | Merchant Account Blog

Powered by vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC6

Loans | Remortgages | Business Credit Card | Online Advertising | Mortgage

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49