Hi freinds,

I need your help regarding the following piece of code.

public unsafe struct GUID
    {
        public int Data1;
        public System.UInt16 Data2;
        public System.UInt16 Data3;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
        public byte[] Data4;
    }

When I build the code, I get the following error:-

Usafe code may only appear if compiling with /unsafe

Please reply with suggestions.

Go to your Project properties and under Configuration Properties Click on build and then change Allow Unsafe Code blocks tu true.