示例#1
0
        private MethodGenerator Method(string key, AccessModifier scope, MethodModifier modifier, bool isOverride, Method nest)
        {
            var method = MethodGenerator.Method(scope, modifier, typeof(void), key.Replace(" ", string.Empty));

            method.Body(CodeExtensions.Invoke(key, typeof(void), isOverride, GetParameters(method, nest)));
            return(method);
        }
示例#2
0
        protected MethodGenerator Method(string key, AccessModifier scope, MethodModifier modifier, Type returnType, bool isOverride, string parameters = null)
        {
            var method = MethodGenerator.Method(scope, modifier, returnType, key.Replace(" ", string.Empty));
            var line1  = CodeBuilder.InitializeVariable("val", returnType);
            var line2  = CodeExtensions.Invoke(key, returnType, isOverride, parameters);
            var line3  = CodeBuilder.NullVoidOrNot(returnType, string.Empty, "\n" + CodeBuilder.Return("val"));

            method.Body(line1 + line2 + line3);
            return(method);
        }