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

MethodBase.Mono.cs « Reflection « System « src « System.Private.CoreLib « netcore - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b219e9f919ff07fe132af7e1a678bb50d02a3182 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Runtime.CompilerServices;
using System.Reflection.Emit;

namespace System.Reflection
{
	partial class MethodBase
	{
		public static MethodBase GetMethodFromHandle (RuntimeMethodHandle handle)
		{
			if (handle.IsNullHandle ())
				throw new ArgumentException (SR.Argument_InvalidHandle);

			MethodBase m = RuntimeMethodInfo.GetMethodFromHandleInternalType (handle.Value, IntPtr.Zero);
			if (m == null)
				throw new ArgumentException (SR.Argument_InvalidHandle);

			Type declaringType = m.DeclaringType;
			if (declaringType != null && declaringType.IsGenericType)
				throw new ArgumentException (String.Format (SR.Argument_MethodDeclaringTypeGeneric,
															m, declaringType.GetGenericTypeDefinition ()));

			return m;
		}

		public static MethodBase GetMethodFromHandle (RuntimeMethodHandle handle, RuntimeTypeHandle declaringType)
		{
			if (handle.IsNullHandle ())
				throw new ArgumentException (SR.Argument_InvalidHandle);
			MethodBase m = RuntimeMethodInfo.GetMethodFromHandleInternalType (handle.Value, declaringType.Value);
			if (m == null)
				throw new ArgumentException (SR.Argument_InvalidHandle);
			return m;
		}

		[MethodImplAttribute (MethodImplOptions.InternalCall)]
		public extern static MethodBase GetCurrentMethod ();

		internal virtual ParameterInfo[] GetParametersNoCopy ()
		{
			return GetParametersInternal ();
		}

		internal virtual ParameterInfo[] GetParametersInternal ()
		{
			throw new NotImplementedException ();
		}

		internal virtual int GetParametersCount ()
		{
			throw new NotImplementedException ();
		}

		internal virtual Type GetParameterType (int pos)
		{
			throw new NotImplementedException ();
		}

		internal virtual Type[] GetParameterTypes ()
		{
			ParameterInfo[] paramInfo = GetParametersNoCopy ();

			Type[] parameterTypes = new Type [paramInfo.Length];
			for (int i = 0; i < paramInfo.Length; i++)
				parameterTypes [i] = paramInfo [i].ParameterType;

			return parameterTypes;
		}

		internal virtual int get_next_table_index (object obj, int table, int count)
		{
			throw new NotImplementedException ();
		}
	}
}