2 // This tests checks that the compiler catches the special attributes
3 // for in a struct for CharSet, and turns the right bit on the TypeAttribute
6 using System
.Reflection
;
7 using System
.Runtime
.InteropServices
;
9 [StructLayout(LayoutKind
.Explicit
, Size
=32,CharSet
=CharSet
.Unicode
)]
12 [FieldOffset(0)] public float fh_float
;
13 [FieldOffset(0)] public int fh_int
;
16 [StructLayout(LayoutKind
.Explicit
, Size
=32,CharSet
=CharSet
.Ansi
)]
19 [FieldOffset(0)] public float fh_float
;
20 [FieldOffset(0)] public int fh_int
;
22 [StructLayout(LayoutKind
.Explicit
, Size
=32,CharSet
=CharSet
.Auto
)]
25 [FieldOffset(0)] public float fh_float
;
26 [FieldOffset(0)] public int fh_int
;
35 Type t
= typeof (MyUnicode
);
37 if ((t
.Attributes
& TypeAttributes
.StringFormatMask
) != TypeAttributes
.UnicodeClass
){
38 Console
.WriteLine ("Class MyUnicode does not have Unicode bit set");
43 if ((t
.Attributes
& TypeAttributes
.StringFormatMask
) != TypeAttributes
.AutoClass
){
44 Console
.WriteLine ("Class MyAuto does not have Auto bit set");
50 if ((t
.Attributes
& TypeAttributes
.StringFormatMask
) != TypeAttributes
.AnsiClass
){
51 Console
.WriteLine ("Class MyUnicode does not have Ansi bit set");