Beispiel #1
0
        //public static CodeAssignStatement assign<TResult, T>(Expression<Func<TResult, LinqToCodedom.Generator.CodeDom.NilClass>> name,
        //    Expression<Func<TResult, T>> stmt)
        //{
        //    return new CodeAssignStatement(
        //        new CodeExpressionVisitor(new VisitorContext()).Visit(name),
        //        new CodeExpressionVisitor(new VisitorContext()).Visit(stmt));
        //}

        public static CodeAssignStatement assignDelegate(string varName, Base target, string methodName)
        {
            return(new CodeAssignStatement(
                       new CodeVariableReferenceExpression(varName),
                       new CodeMethodReferenceExpression(CodeDom.GetTargetObject(target), methodName)
                       ));
        }
Beispiel #2
0
 public static CodeRemoveEventStatement detachDelegate(Base owner, string eventName,
                                                       string staticMethodName)
 {
     return(new CodeRemoveEventStatement(
                CodeDom.GetTargetObject(owner), eventName,
                new CodeMethodReferenceExpression(null, staticMethodName)
                ));
 }
Beispiel #3
0
 public static CodeAttachEventStatement attachDelegate(Base owner, string eventName,
                                                       Base target, string methodName)
 {
     return(new CodeAttachEventStatement(
                CodeDom.GetTargetObject(owner), eventName,
                new CodeMethodReferenceExpression(CodeDom.GetTargetObject(target), methodName)
                ));
 }