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

TypeBaseTypeUseViaReflection.cs « Reflection « Mono.Linker.Tests.Cases « test - github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e611a96de4e2184d45daf844c518a2e34374e952 (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
36
37
38
39
40
41
42
43
44
45
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Mono.Linker.Tests.Cases.Expectations.Assertions;

namespace Mono.Linker.Tests.Cases.Reflection
{
	public class TypeBaseTypeUseViaReflection
	{
		public static void Main ()
		{
			KnownType_Derived.Test ();
		}

		[Kept]
		class KnownType_Base
		{
			[Kept]
			public KnownType_Base () { }

			[Kept]
			private static void UsedViaReflection () { }

			private static void Unused () { }
		}

		[Kept]
		[KeptBaseType (typeof (KnownType_Base))]
		class KnownType_Derived : KnownType_Base
		{
			[Kept]
			public static void Test ()
			{
				typeof (KnownType_Derived).BaseType.GetMethod ("UsedViaReflection", BindingFlags.NonPublic | BindingFlags.Static);
				typeof (KnownType_Derived).BaseType.GetConstructor (Type.EmptyTypes);
			}
		}
	}
}