AddMethod() public method

Add a method to this class
public AddMethod ( string name, GenericParam genPars, Type retType, Type pars ) : MethodRef
name string method name
genPars GenericParam generic parameters
retType Type return type
pars Type parameter types
return MethodRef
Esempio n. 1
0
        internal static MethodRef AddStaticMethod(ClassRef classRef, string name, PERWAPI.Type retType, PERWAPI.Type[] args)
        {
            MethodRef method = classRef.GetMethod(name, args);

            if (method == null)
                method = classRef.AddMethod(name, retType, args);
            
            return method;
        }
Esempio n. 2
0
 internal static MethodRef MethodBodyCtor(ClassRef klass)
 {
     MethodRef ctor = klass.GetMethod(".ctor");
     if (ctor != null)
         return ctor;
     else
     {
         ctor = klass.AddMethod(".ctor", PrimitiveType.Void, new Type[0]);
         ctor.AddCallConv(CallConv.Instance);
         return ctor;
     }
 }
Esempio n. 3
0
        internal static MethodRef AddInstanceMethod(ClassRef classRef, string name, PERWAPI.Type retType, PERWAPI.Type[] args)
        {
            MethodRef method = classRef.GetMethod(name, args);

            if (method == null || method.GetCallConv() != CallConv.Instance)
            {
                method = classRef.AddMethod(name, retType, args);
                method.AddCallConv(CallConv.Instance);
            }
            return method;
        }