0
Answer

how to correctly use the attribute "FieldOffset" in .Net Compact Framework

Photo of zhangjianke0717

zhangjianke0717

20y
2.9k
1
recently,I wrote some codes,but there is something wrong in my programme.some of codes follow: using System.Runtime.InteropServices; [StructLayout(LayoutKind.Explicit)] public class MyUnion { [FieldOffset(0)] G00 g00; [FieldOffset(0)] G01 g01; [FieldOffset(0)] G02_G03 g02_g03; [FieldOffset(0)] G12 g12; [FieldOffset(0)] ellips g12_g13; [FieldOffset(0)] g16type g16; [FieldOffset(0)] G04 g04; [FieldOffset(0)] G31 g31; [FieldOffset(0)] G33 g33; [FieldOffset(0)] G87 g87; [FieldOffset(0)] G88 g88; [FieldOffset(0)] S s; public MyUnion() { // // TODO: ??????????? // } } And the wrong information belows: C:\Documents and Settings\gr\My Documents\Visual Studio Projects\GL2000_32bit\FunctionStruct.cs(1063): can not find the class or namespace“FieldOffset”(lack using .....?) But the same code is right in .Net Framework.So is there anyone who can help to resolve the problem? Thank you!

Answers (0)