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
Ejemplo 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;
        }
Ejemplo 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;
     }
 }
Ejemplo 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;
        }