protected CodeParameter AddParameter(CodeParameterDeclarationExpressionCollection collection, string name, object type, object position)
        {
            CodeTypeRef          typeRef = ObjectToTypeRef(type);
            CodeDomCodeParameter cdParam = new CodeDomCodeParameter(DTE, this, name, typeRef);

            collection.Insert(PositionToParameterIndex(collection, position), cdParam.CodeObject);
            return(cdParam);
        }
        protected CodeElements GetParameters(CodeParameterDeclarationExpressionCollection collection)
        {
            CodeDomCodeElements res = new CodeDomCodeElements(DTE, this);

            foreach (CodeParameterDeclarationExpression param in collection)
            {
                if (param.UserData[CodeKey] == null)
                {
                    param.UserData[CodeKey] = new CodeDomCodeParameter(this, param);
                }
                res.Add(CodeDomCodeParameter.GetCodeParameter(param));
            }
            return(res);
        }
        protected void RemoveParameter(CodeParameterDeclarationExpressionCollection collection, object element)
        {
            string strElement = element as string;
            int    index      = 0;

            foreach (CodeParameterDeclarationExpression param in collection)
            {
                if (strElement == null && CodeDomCodeParameter.GetCodeParameter(param) == element)
                {
                    collection.RemoveAt(index);
                    break;
                }
                else if (strElement != null && param.Name == strElement)
                {
                    collection.RemoveAt(index);
                    break;
                }

                index++;
            }
        }