Union with C#

2014/11/13

this post is about cool, fun yet not so practical capability of C#.actually C# support this capability from its' early days, yet I become aware of It quite recently by my colleague Ofir Makmal. Union is kind of cool thing where you can look at the same address space from different angle. for example: 64 bit can be a long, 2 integer or 8 bytes. the trick is to set the offset of the field within the memory structure.this is done by using and like shown in the following snippet: class StrangeStruct { ...
one comment