blob: ace5ef940b4f795d2efdf830dce8b22524dc05ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
using System;
using System.Runtime.InteropServices;
public struct MyStruct
{
public int X { get; set; }
}
[StructLayout (LayoutKind.Sequential, Pack = 1)]
public struct MyStruct2
{
public IntPtr handle;
public uint type_reference;
}
class X
{
public static int Main ()
{
var s = typeof (MyStruct);
if (s.StructLayoutAttribute.Size != 0)
return 1;
var s2 = typeof (MyStruct2);
if (s2.StructLayoutAttribute.Size != 0)
return 2;
if (s2.StructLayoutAttribute.Pack != 1)
return 3;
return 0;
}
}
|