2 Copyright (C) 2009 Jeroen Frijters
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
12 1. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
16 2. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
18 3. This notice may not be removed or altered from any source distribution.
26 namespace IKVM.Reflection
28 public abstract class MethodBase : MemberInfo
30 // prevent external subclasses
35 internal abstract MethodSignature MethodSignature { get; }
36 internal abstract int ParameterCount { get; }
37 public abstract ParameterInfo[] GetParameters();
38 public abstract MethodAttributes Attributes { get; }
39 public abstract MethodImplAttributes GetMethodImplementationFlags();
40 public abstract MethodBody GetMethodBody();
41 public abstract CallingConventions CallingConvention { get; }
43 public bool IsConstructor
47 if ((this.Attributes & MethodAttributes.RTSpecialName) != 0)
49 string name = this.Name;
50 return name == ConstructorInfo.ConstructorName || name == ConstructorInfo.TypeConstructorName;
58 get { return (Attributes & MethodAttributes.Static) != 0; }
63 get { return (Attributes & MethodAttributes.Virtual) != 0; }
66 public bool IsAbstract
68 get { return (Attributes & MethodAttributes.Abstract) != 0; }
73 get { return (Attributes & MethodAttributes.Final) != 0; }
78 get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public; }
83 get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Family; }
86 public bool IsFamilyOrAssembly
88 get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamORAssem; }
91 public bool IsAssembly
93 get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Assembly; }
96 public bool IsFamilyAndAssembly
98 get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamANDAssem; }
101 public bool IsPrivate
103 get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private; }
106 public bool IsSpecialName
108 get { return (Attributes & MethodAttributes.SpecialName) != 0; }
111 public bool IsHideBySig
113 get { return (Attributes & MethodAttributes.HideBySig) != 0; }
116 public virtual Type[] GetGenericArguments()
118 return Type.EmptyTypes;
121 public virtual bool IsGenericMethod
123 get { return false; }
126 public virtual bool IsGenericMethodDefinition
128 get { return false; }
131 public virtual bool ContainsGenericParameters
133 get { return IsGenericMethodDefinition; }
136 public virtual MethodBase __GetMethodOnTypeDefinition()
141 // This goes to the (uninstantiated) MethodInfo on the (uninstantiated) Type. For constructors
142 // it also has the effect of removing the ConstructorInfo wrapper and returning the underlying MethodInfo.
143 internal abstract MethodInfo GetMethodOnTypeDefinition();
145 internal abstract int ImportTo(Emit.ModuleBuilder module);
147 internal abstract MethodBase BindTypeParameters(Type type);