public override bool OnExportCode(ActionBranch previousAction, ActionBranch nextAction, ILimnorCodeCompiler compiler, CodeMemberMethod method, CodeStatementCollection statements)
        {
            bool bRet;

            if (_actionData == null)
            {
                _actionData = (ActionSubMethod)this.Method.GetActionInstance(_actId.ActionId);                // (ActionSubMethod)compiler.ActionEventList.GetAction(_actId);
            }
            SubMethodInfoPointer smi = _actionData.ActionMethod as SubMethodInfoPointer;
            SubMethodInfo        mi  = smi.MethodInformation as SubMethodInfo;

            if (mi.IsForeach)
            {
                ParameterClassSubMethod p  = mi.GetParameterType(0, smi, this);
                StringBuilder           sb = new StringBuilder();
                string s1 = smi.Owner.CodeName;
                CustomMethodParameterPointer cmpp = smi.Owner.Owner as CustomMethodParameterPointer;
                if (cmpp == null)
                {
                    IObjectPointer op = smi.Owner;
                    sb.Append(s1);
                    while (!(op is ILocalvariable) && op.Owner != null && !(op.Owner is MethodClass) && op.Owner.Owner != null)
                    {
                        if (string.CompareOrdinal(s1, op.Owner.CodeName) != 0)
                        {
                            s1 = op.Owner.CodeName;
                            sb.Insert(0, ".");
                            sb.Insert(0, s1);
                        }
                        op = op.Owner;
                    }
                    s1 = sb.ToString();
                }
                string itemTypeString = null;
                if (mi.ItemType.IsGenericParameter)
                {
                    CollectionPointer cp = smi.Owner as CollectionPointer;
                    if (cp != null)
                    {
                        CustomPropertyPointer cpp = cp.Owner as CustomPropertyPointer;
                        if (cpp != null)
                        {
                            DataTypePointer dtp = cpp.GetConcreteType(mi.ItemType);
                            if (dtp != null)
                            {
                                itemTypeString = dtp.TypeString;
                            }
                        }
                    }
                }
                if (string.IsNullOrEmpty(itemTypeString))
                {
                    itemTypeString = VPLUtil.GetTypeCSharpName(mi.ItemType);
                }
                string s0 = string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                          "{0}foreach({1} {2} in {3}) {{", Indentation.GetIndent(), itemTypeString, p.CodeName, s1);
                CodeStatement cis0 = new CodeSnippetStatement(s0);
                statements.Add(cis0);
                //
                if (_iconList != null)
                {
                    foreach (ComponentIcon ci in _iconList)
                    {
                        ComponentIconLocal cil = ci as ComponentIconLocal;
                        if (cil != null && cil.ScopeGroupId == this.BranchId)
                        {
                            cil.LocalPointer.AddVariableDeclaration(statements);
                        }
                    }
                }
                //
                CodeStatementCollection sc = new CodeStatementCollection();
                Method.SubMethod.Push(this);                //smi);
                CompilerUtil.AddSubMethod(method, this);
                bRet = base.OnExportCode(previousAction, nextAction, compiler, method, sc);
                Method.SubMethod.Pop();

                bRet = CompilerUtil.FinishSubMethod(method, this, sc, bRet);
                statements.AddRange(sc);
                //
                statements.Add(new CodeSnippetStatement(string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}}}", Indentation.GetIndent())));
            }
            else
            {
                CodeIterationStatement cis = new CodeIterationStatement();
                cis.TestExpression     = mi.GetTestExpression(smi, compiler, this.Method, method, statements, this.BranchId);
                cis.InitStatement      = mi.GetInitStatement(smi, compiler, this.Method, method, statements, this.BranchId);
                cis.IncrementStatement = mi.GetIncrementalStatement(smi, compiler, this.Method, method, statements, this.BranchId);
                //
                Method.SubMethod.Push(this);                //smi);
                CompilerUtil.AddSubMethod(method, this);
                if (_iconList != null)
                {
                    foreach (ComponentIcon ci in _iconList)
                    {
                        ComponentIconLocal cil = ci as ComponentIconLocal;
                        if (cil != null && cil.ScopeGroupId == this.BranchId)
                        {
                            cil.LocalPointer.AddVariableDeclaration(cis.Statements);
                        }
                    }
                }
                bRet = base.OnExportCode(previousAction, nextAction, compiler, method, cis.Statements);
                Method.SubMethod.Pop();

                bRet = CompilerUtil.FinishSubMethod(method, this, cis.Statements, bRet);
                //
                //
                statements.Add(cis);
            }

            return(bRet);
        }