Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ExplicitClass.cs « Attributes.StructLayout « Mono.Linker.Tests.Cases « test - github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dc9f60013097fa44cda51a9c7ad27c38b3d057b0 (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
using System;
using System.Runtime.InteropServices;
using Mono.Linker.Tests.Cases.Expectations.Assertions;

namespace Mono.Linker.Tests.Cases.Attributes.StructLayout {
	[StructLayout (LayoutKind.Explicit)]
	[KeptMember (".ctor()")]
	class ExplicitClassData {
		[FieldOffset (0)]
		[Kept] // the linker could remove this
		public int never_used;
		[FieldOffset (4)]
		[Kept]
		public int used;
		[FieldOffset (8)]
		[Kept]
		public int never_ever_used;
	}

	public class ExplicitClass
	{
		public static void Main ()
		{
			var c = new ExplicitClassData ();
			c.used = 1;
		}
	}
}