Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class Program {
- [System.Runtime.InteropServices.StructLayout( System.Runtime.InteropServices.LayoutKind.Explicit )]
- private struct Union {
- [System.Runtime.InteropServices.FieldOffset( 0 )]
- public System.Byte ByteField;
- [System.Runtime.InteropServices.FieldOffset( 0 )]
- public System.Boolean BooleanField;
- }
- [System.STAThread]
- public static System.Int32 Main( System.String[] args ) {
- var u1 = new Union {
- ByteField = 1
- };
- var u2 = new Union {
- ByteField = 2
- };
- System.Console.Out.WriteLine( u1.BooleanField == u2.BooleanField );
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement