Inheritance: System.CodeDom.CodeExpression
		public void Constructor0 ()
		{
			CodeParameterDeclarationExpression cpde = new CodeParameterDeclarationExpression ();
			Assert.IsNotNull (cpde.CustomAttributes, "#1");
			Assert.AreEqual (0, cpde.CustomAttributes.Count, "#2");
			Assert.AreEqual (FieldDirection.In, cpde.Direction, "#3");
			Assert.IsNotNull (cpde.Name, "#4");
			Assert.AreEqual (string.Empty, cpde.Name, "#5");
			Assert.IsNotNull (cpde.Type, "#6");
			Assert.AreEqual (typeof (void).FullName, cpde.Type.BaseType, "#7");

			cpde.Direction = FieldDirection.Out;
			Assert.AreEqual (FieldDirection.Out, cpde.Direction, "#8");

			string name = "mono";
			cpde.Name = name;
			Assert.AreSame (name, cpde.Name, "#9");

			cpde.Name = null;
			Assert.IsNotNull (cpde.Name, "#10");
			Assert.AreEqual (string.Empty, cpde.Name, "#11");

			CodeTypeReference type = new CodeTypeReference ("mono");
			cpde.Type = type;
			Assert.AreSame (type, cpde.Type, "#12");

			cpde.Type = null;
			Assert.IsNotNull (cpde.Type, "#13");
			Assert.AreEqual (typeof (void).FullName, cpde.Type.BaseType, "#14");
		}
Exemplo n.º 2
0
        // Builds a codedom delegate expression and attaches it to the given codedom namespace.
        public static void Emit(CodeNamespace codeNamespace, DelegateDeclaration del)
        {
            // Create the codedom delegate and attach it to the namespace.
            var codeDelegate = new CodeTypeDelegate();
            codeNamespace.Types.Add(codeDelegate);

            // Assign the name of the delegate
            codeDelegate.Name = del.Name;

            // Set the type of the delegate: make sure to check for null
            if (del.ReturnTypeName == "void")
                codeDelegate.ReturnType = null;
            else
                codeDelegate.ReturnType = new CodeTypeReference(del.ReturnTypeName);

            // Translate the accessibililty of the delegate
            MemberAttributes attributes = MemberAttributes.Public;
            switch(del.Accessibility)
            {
                case Accessibility.Public:
                    attributes = MemberAttributes.Public;
                    break;
                case Accessibility.Protected:
                    attributes = MemberAttributes.Family;
                    break;
                case Accessibility.Private:
                    attributes = MemberAttributes.Private;
                    break;
                case Accessibility.Internal:
                    attributes = MemberAttributes.FamilyAndAssembly;
                    break;
            }

            // Shared = static
            if (del.IsShared)
                attributes |= MemberAttributes.Static;

            codeDelegate.Attributes = attributes;

            // Translate the parameters of the delegate.
            foreach (Expression p in del.Parameters)
            {
                if (p is SimpleParameter) // ex "int i"
                    codeDelegate.Parameters.Add(new CodeParameterDeclarationExpression((p as SimpleParameter).TypeName, (p as SimpleParameter).Name));
                if (p is DirectionedParameter) // ex "ref int t"
                {
                    var codeParameter = new CodeParameterDeclarationExpression((p as DirectionedParameter).TypeName, (p as DirectionedParameter).Name);
                    switch ((p as DirectionedParameter).Direction)
                    {
                        case ParameterDirection.Out:
                            codeParameter.Direction = FieldDirection.Out;
                            break;
                        case ParameterDirection.Ref:
                            codeParameter.Direction = FieldDirection.Ref;
                            break;
                    }
                    codeDelegate.Parameters.Add(codeParameter);
                }
            }
        }
Exemplo n.º 3
0
        public override void DeclareCodeType(IDLInterface idlIntf)
        {
            // Proxy class.
            typeProxy = new CodeTypeDeclaration(name + "Proxy");
            typeProxy.IsClass = true;
            typeProxy.TypeAttributes = TypeAttributes.Public;
            eventsDeclarationHolder = new CodeTypeDeferredNamespaceDeclarationHolderEvents(idlIntf);
            typeProxy.BaseTypes.Add(genInterfaceName);

            // Interface field.
            CodeMemberField memberProxy = new CodeMemberField(genInterfaceName, proxyName);
            memberProxy.Attributes = MemberAttributes.Private;
            typeProxy.Members.Add(memberProxy); // TODO: Going to need a using or a fully qualified name.

            // Constructor.
            CodeConstructor constructor = new CodeConstructor();
            constructor.Attributes = MemberAttributes.Public;
            // TODO - use the actual interface type rather than a string.
            paramProxy = new CodeParameterDeclarationExpression(genInterfaceName, proxyName);
            constructor.Parameters.Add(paramProxy);
            thisProxyFieldRef = new CodeFieldReferenceExpression(
                new CodeThisReferenceExpression(), proxyName
            );
            assignProxy = new CodeAssignStatement(thisProxyFieldRef,
                new CodeArgumentReferenceExpression(proxyName));
            constructor.Statements.Add(assignProxy);
            typeProxy.Members.Add(constructor);

            declarationHolder = new CodeTypeIgnoredNamespaceDeclarationHolderParams(idlIntf);
            contextDeclarationHolder = declarationHolder;

            bAddNamespace = false;
        }
        internal BindingElementExtensionSectionGenerator(Type bindingElementType, Assembly userAssembly, CodeDomProvider provider)
        {
            this.bindingElementType = bindingElementType;
            this.userAssembly = userAssembly;
            this.provider = provider;

            string typePrefix = bindingElementType.Name.Substring(0, bindingElementType.Name.IndexOf(TypeNameConstants.BindingElement));
            this.generatedClassName = typePrefix + Constants.ElementSuffix;
            this.constantsClassName = bindingElementType.Name.Substring(0, bindingElementType.Name.IndexOf(TypeNameConstants.BindingElement)) + Constants.ConfigurationStrings;
            this.defaultValuesClassName = bindingElementType.Name.Substring(0, bindingElementType.Name.IndexOf(TypeNameConstants.BindingElement)) + Constants.Defaults;

            this.customBEVarInstance = Helpers.TurnFirstCharLower(bindingElementType.Name);
            customBEArgRef = new CodeArgumentReferenceExpression(customBEVarInstance);

            this.customBETypeRef = new CodeTypeReference(bindingElementType.Name);
            this.customBETypeOfRef = new CodeTypeOfExpression(customBETypeRef);
            this.customBENewVarAssignRef = new CodeVariableDeclarationStatement(
                                                customBETypeRef,
                                                customBEVarInstance,
                                                new CodeObjectCreateExpression(customBETypeRef));
            this.bindingElementMethodParamRef = new CodeParameterDeclarationExpression(
                                                    CodeDomHelperObjects.bindingElementTypeRef,
                                                    Constants.bindingElementParamName);

        }
        internal CodeConstructor CreateRequiredConstructor(CodeTypeDeclaration resourceClass,
                                                           IMethod request,
                                                           bool addOptionalParameters)
        {
            var constructor = new CodeConstructor();
            constructor.Attributes = MemberAttributes.Public;

            // IRequestProvider service
            var serviceArg = new CodeParameterDeclarationExpression(typeof(IRequestProvider), ServiceName);
            constructor.Parameters.Add(serviceArg);

            // : base(service, "path", "HTTPMETHOD")
            constructor.BaseConstructorArgs.Add(
                new CodePropertyReferenceExpression(
                    new CodeVariableReferenceExpression(ServiceName), BaseUriName));
            constructor.BaseConstructorArgs.Add(new CodePrimitiveExpression(request.MediaUpload.Simple.Path));
            constructor.BaseConstructorArgs.Add(new CodePrimitiveExpression(request.HttpMethod));

            // Add all required arguments to the constructor.
            AddBodyParameter(constructor, request);

            // Add common upload arguements.
            constructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression(StreamParameterName));
            constructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression(ContentTypeParameterName));

            AddAuthorizationAssignment(constructor);
            AddRequestParameters(resourceClass, request, constructor, addOptionalParameters);

            constructor.Parameters.Add(new CodeParameterDeclarationExpression(
                new CodeTypeReference(typeof(System.IO.Stream)), StreamParameterName));
            constructor.Parameters.Add(new CodeParameterDeclarationExpression(
                new CodeTypeReference(typeof(System.String)), ContentTypeParameterName));

            return constructor;
        }
        public void Visit(ProcedureDefinition statement)
        {
            var argList = new List<CodeParameterDeclarationExpression>();
            foreach (var arg in statement.Args)
            {
                var variableType = TablePrimitive.FromString(arg.Type).Type;
                var codeParam = new CodeParameterDeclarationExpression(variableType, arg.Variable);
                Scope.Current.RegisterPrimitive(codeParam.Name, variableType, codeParam.Type);
                Scope.Current.Type.Type.Members.Add(new CodeMemberField() { Name = codeParam.Name, Type = codeParam.Type, Attributes = MemberAttributes.Public | MemberAttributes.Final });

                var assignment = new CodeAssignStatement(new CodeVariableReferenceExpression("_" + Scope.Current.ScopeIdentifier + "." + codeParam.Name), new CodeVariableReferenceExpression(codeParam.Name));
                _mainType.Constructor.Statements.Add(assignment);

                argList.Add(codeParam);
            }

            _mainType.Type.Name = statement.Name;
            _mainType.Constructor.Parameters.Clear();
            _mainType.Constructor.BaseConstructorArgs.Clear();
            _mainType.Constructor.Parameters.AddRange(argList.ToArray());
            _mainType.Constructor.BaseConstructorArgs.Add(new CodeArrayCreateExpression(new CodeTypeReference(typeof(string[])), 0));

            //visit block
            var blockArgs = VisitChild(statement.Block);
            _codeStack.Peek().ParentStatements.AddRange(blockArgs.ParentStatements);
        }
Exemplo n.º 7
0
        // Generates a codedom constructor expression and attaches it to the given type.
        public static void Emit(CodeTypeDeclaration codeTypeDeclaration, Constructor ctor)
        {
            // Create the codedom constructor
            var codeCtor = new CodeConstructor();
            codeTypeDeclaration.Members.Add(codeCtor);

            // Translate accessibility of the constructor
            MemberAttributes memberAttributes = MemberAttributes.Public;
            switch (ctor.Accessibility)
            {
                case Accessibility.Internal:
                    memberAttributes |= MemberAttributes.FamilyAndAssembly;
                    break;
                case Accessibility.Private:
                    memberAttributes |= MemberAttributes.Private;
                    break;
                case Accessibility.Protected:
                    memberAttributes |= MemberAttributes.Family;
                    break;
                case Accessibility.Public:
                    memberAttributes |= MemberAttributes.Public;
                    break;
            }
            codeCtor.Attributes = memberAttributes;

            // Translate the parameters of the constructor
            foreach (Expression p in ctor.Parameters)
            {
                if (p is SimpleParameter) // ex "int i"
                    codeCtor.Parameters.Add(new CodeParameterDeclarationExpression((p as SimpleParameter).TypeName, (p as SimpleParameter).Name));
                if (p is DirectionedParameter) // ex "ref int i"
                {
                    var codeParameter = new CodeParameterDeclarationExpression((p as DirectionedParameter).TypeName, (p as DirectionedParameter).Name);
                    switch ((p as DirectionedParameter).Direction)
                    {
                        case ParameterDirection.Out:
                            codeParameter.Direction = FieldDirection.Out;
                            break;
                        case ParameterDirection.Ref:
                            codeParameter.Direction = FieldDirection.Ref;
                            break;
                    }
                    codeCtor.Parameters.Add(codeParameter);
                }
            }

            // Add call to a constructor of the base class or another in the same class.
            foreach (var a in ctor.SubParameters.ChildExpressions)
            {
                if (ctor.Sub)
                    codeCtor.ChainedConstructorArgs.Add(CodeDomEmitter.EmitCodeExpression(a));
                else
                    codeCtor.BaseConstructorArgs.Add(CodeDomEmitter.EmitCodeExpression(a));
            }

            // Add all the statements in the body of the constructor
            foreach (var e in ctor.ChildExpressions)
                codeCtor.Statements.Add(CodeDomEmitter.EmitCodeStatement(e));
        }
 /// <devdoc>
 /// <para>Copies the elements of an array to the end of the <see cref='System.CodeDom.CodeParameterDeclarationExpressionCollection'/>.</para>
 /// </devdoc>
 public void AddRange(CodeParameterDeclarationExpression[] value) {
     if (value == null) {
         throw new ArgumentNullException("value");
     }
     for (int i = 0; ((i) < (value.Length)); i = ((i) + (1))) {
         this.Add(value[i]);
     }
 }
Exemplo n.º 9
0
        private static CodeParameterDeclarationExpression GetParameterExpression(ParameterInfo parameter)
        {
            var p = new CodeParameterDeclarationExpression();
            p.Name = parameter.Name;
            p.Type = new CodeTypeReference(parameter.ParameterType);

            return p;
        }
		public void Constructor1_NullItem ()
		{
			CodeParameterDeclarationExpression[] parameters = new CodeParameterDeclarationExpression[] { 
				new CodeParameterDeclarationExpression (), null };

			CodeParameterDeclarationExpressionCollection coll = new CodeParameterDeclarationExpressionCollection (
				parameters);
		}
Exemplo n.º 11
0
 CodeMemberMethod LocalMethod(string name)
 {
     var method = new CodeMemberMethod { Name = name, ReturnType = new CodeTypeReference(typeof(object)) };
     var param = new CodeParameterDeclarationExpression(typeof(object[]), args);
     param.UserData.Add(Parser.RawData, typeof(object[]));
     method.Parameters.Add(param);
     return method;
 }
Exemplo n.º 12
0
 internal DesignTimeParameterInfo(CodeParameterDeclarationExpression codeParameter, int position, MemberInfo member)
 {
     this.MemberImpl = member;
     this.NameImpl = Helper.EnsureTypeName(codeParameter.Name);
     this.codeParameterType = codeParameter.Type;
     this.AttrsImpl = Helper.ConvertToParameterAttributes(codeParameter.Direction);
     this.isRef = (codeParameter.Direction == FieldDirection.Ref);
     this.PositionImpl = position;
 }
        public void Visit(CaseVariableStatement statement)
        {
            var domArg = new CodeDomArg();

            CodeMemberMethod method = new CodeMemberMethod();
            method.Name = "Case_" + domArg.MethodIdentifier;
            method.Attributes = MemberAttributes.Private;
            method.ReturnType = new CodeTypeReference(typeof(object));
            GenerateCallStatement(method.Statements, statement.Line.Line);

            var caseArgs = VisitChild(statement.Case, new CodeDomArg() { Scope = _codeStack.Peek().Scope });
            if (caseArgs.Tag != null)
                _codeStack.Peek().Tag = caseArgs.Tag;

            method.Statements.Add(new CodeVariableDeclarationStatement(new CodeTypeReference(typeof(object)), "var", caseArgs.CodeExpression));

            foreach (var childArg in statement.BooleanStatements)
            {
                domArg = VisitChild(childArg, new CodeDomArg() { Scope = _codeStack.Peek().Scope });
                if (domArg.Tag != null)
                    _codeStack.Peek().Tag = domArg.Tag;

                method.Statements.AddRange(domArg.ParentStatements);
            }

            if (statement.ElseStatement == null)
                method.Statements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression(null)));
            else
            {
                domArg = VisitChild(statement.ElseStatement, new CodeDomArg() { Scope = _codeStack.Peek().Scope });
                if (domArg.Tag != null)
                    _codeStack.Peek().Tag = domArg.Tag;

                method.Statements.Add(new CodeMethodReturnStatement(domArg.CodeExpression));
            }

            _mainType.Type.Members.Add(method);

            var methodcall = new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(null, method.Name));
            var rowParam = new CodeParameterDeclarationExpression(_codeStack.Peek().Scope.CodeDomReference.TypeArguments[0], "row");
            method.Parameters.Add(rowParam);
            methodcall.Parameters.Add(new CodeVariableReferenceExpression("row"));

            if(_codeStack.Peek().Tag != null) //pick statement
            {
                var htmlNodeParam = new CodeParameterDeclarationExpression(new CodeTypeReference("HtmlNode"), "node");
                methodcall.Parameters.Add(new CodeVariableReferenceExpression("node"));
                method.Parameters.Add(htmlNodeParam);
            }

            _codeStack.Peek()
                  .ParentStatements.Add(new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("result"),
                      "AddColumn",
                      new CodePrimitiveExpression("(No column name)")));

            _codeStack.Peek().CodeExpression = methodcall;
        }
 public TypescriptParameterDeclarationExpression(
     CodeParameterDeclarationExpression codeExpression,
     CodeGeneratorOptions options,
     ITypescriptTypeMapper typescriptTypeMapper)
 {
     _codeExpression = codeExpression;
     _options = options;
     _typescriptTypeMapper = typescriptTypeMapper;
     System.Diagnostics.Debug.WriteLine("TypescriptParameterDeclarationExpression Created");
 }
		public void AddRange (CodeParameterDeclarationExpression [] value )
		{
			if (value == null) {
				throw new ArgumentNullException ("value");
			}

			for (int i = 0; i < value.Length; i++) {
				Add (value[i]);
			}
		}
 public CodeMemberOperatorOverride(OperatorType type,
     CodeParameterDeclarationExpression[] parameters,
     CodeTypeReference returnType,
     params CodeStatement[] statements)
 {
     m_operator = type;
     m_parameters = parameters;
     m_returnType = returnType;
     m_statements = statements;
 }
 public static CodeParameterDeclarationExpression Clone(this CodeParameterDeclarationExpression expression)
 {
     if (expression == null) return null;
     CodeParameterDeclarationExpression e = new CodeParameterDeclarationExpression();
     e.CustomAttributes = expression.CustomAttributes.Clone();
     e.Direction = expression.Direction;
     e.Name = expression.Name;
     e.Type = expression.Type.Clone();
     e.UserData.AddRange(expression.UserData);
     return e;
 }
		public void Constructor2_Deny_Unrestricted ()
		{
			CodeParameterDeclarationExpression cpde = new CodeParameterDeclarationExpression ("System.Int32", "mono");
			Assert.AreEqual (0, cpde.CustomAttributes.Count, "CustomAttributes");
			cpde.CustomAttributes = new CodeAttributeDeclarationCollection ();
			Assert.AreEqual (FieldDirection.In, cpde.Direction, "Direction");
			cpde.Direction = FieldDirection.Out;
			Assert.AreEqual ("mono", cpde.Name, "Name");
			cpde.Name = String.Empty;
			Assert.AreEqual ("System.Int32", cpde.Type.BaseType, "Type");
			cpde.Type = new CodeTypeReference ("System.Int32");
		}
		public void Constructor1 ()
		{
			CodeParameterDeclarationExpression param1 = new CodeParameterDeclarationExpression ();
			CodeParameterDeclarationExpression param2 = new CodeParameterDeclarationExpression ();

			CodeParameterDeclarationExpression[] parameters = new CodeParameterDeclarationExpression[] { param1, param2 };
			CodeParameterDeclarationExpressionCollection coll = new CodeParameterDeclarationExpressionCollection (
				parameters);

			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (param1), "#2");
			Assert.AreEqual (1, coll.IndexOf (param2), "#3");
		}
        private CodeMemberMethod GenerateInterfaceImplementationForOperationContract(MethodInfo method)
        {
            var genMethod = new CodeMemberMethod();
            genMethod.ReturnType = new CodeTypeReference(method.ReturnType);
            genMethod.Name = method.Name;
            genMethod.Attributes = MemberAttributes.Public;

            foreach (var parameter in method.GetParameters())
            {
                var genParam = new CodeParameterDeclarationExpression(parameter.ParameterType, parameter.Name);
                genMethod.Parameters.Add(genParam);
            }

            PreventInliningOfGeneratedMethod(genMethod);
            
            //Now generate the implementation, we just want to call into the base.CreateRestRequestForparentMethod(new object[]{arg0, arg1, arg2} )
            CodeMethodInvokeExpression invokeExpression = null;

            if (this.IsAsync(method))
            {
                if (method.ReturnType.IsGenericType)
                {
                    invokeExpression = new CodeMethodInvokeExpression(
                        new CodeMethodReferenceExpression(new CodeBaseReferenceExpression(),
                                                          "CreateAndInvokeRestRequestForParentMethodAsync",
                                                          new CodeTypeReference(
                                                              method.ReturnType.GetGenericArguments().Single())));
                }
                else
                {
                    invokeExpression = new CodeMethodInvokeExpression(
                        new CodeMethodReferenceExpression(new CodeBaseReferenceExpression(),
                                                          "CreateAndInvokeRestRequestForParentMethodAsync"));
                }
            }
            else
            {
                invokeExpression = new CodeMethodInvokeExpression(new CodeBaseReferenceExpression(), "CreateAndInvokeRestRequestForParentMethod");
            }

            //Now add the arguments of parent method in the same order in the end of the invocation
            foreach (ParameterInfo parameter in method.GetParameters())
            {
                invokeExpression.Parameters.Add(new CodeVariableReferenceExpression(parameter.Name));
            }

            GenerateAddReturnStatementFromInvokeExpressionIfNeeded(method, genMethod, invokeExpression);

            return genMethod;
        }
		public void Constructor2 ()
		{
			CodeParameterDeclarationExpression param1 = new CodeParameterDeclarationExpression ();
			CodeParameterDeclarationExpression param2 = new CodeParameterDeclarationExpression ();

			CodeParameterDeclarationExpressionCollection c = new CodeParameterDeclarationExpressionCollection ();
			c.Add (param1);
			c.Add (param2);

			CodeParameterDeclarationExpressionCollection coll = new CodeParameterDeclarationExpressionCollection (c);
			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (param1), "#2");
			Assert.AreEqual (1, coll.IndexOf (param2), "#3");
		}
 protected override void Constructor(CodeTypeDeclaration typeProxy, CodeTypeReference typerefDbusInterface)
 {
     CodeConstructor constructor = new CodeConstructor();
     constructor.Attributes = MemberAttributes.Public;
     CodeParameterDeclarationExpression paramProxy = new CodeParameterDeclarationExpression(typerefDbusInterface, CodeBuilderCommon.targetName);
     constructor.Parameters.Add(paramProxy);
     CodeFieldReferenceExpression thisProxyFieldRef = new CodeFieldReferenceExpression(
         new CodeThisReferenceExpression(), CodeBuilderCommon.targetName
     );
     CodeAssignStatement assignProxy = new CodeAssignStatement(thisProxyFieldRef,
         new CodeArgumentReferenceExpression(CodeBuilderCommon.targetName));
     constructor.Statements.Add(assignProxy);
     typeProxy.Members.Add(constructor);
 }
Exemplo n.º 23
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="member"></param>
        /// <param name="inner"></param>
        /// <param name="attrs"></param>
        /// <returns></returns>
        public CodeTypeMember CreateMember(MemberInfo member, CodeFieldReferenceExpression inner, MemberAttributes attrs)
        {
            Debug.Assert(member is MethodInfo);
            MethodInfo method = member as MethodInfo;
            CodeMemberMethod codeMethod = new CodeMemberMethod();

            codeMethod.Name = method.Name;
            codeMethod.ReturnType = new CodeTypeReference(method.ReturnType);
            codeMethod.Attributes = attrs;

            // try
            CodeTryCatchFinallyStatement tryCode = new CodeTryCatchFinallyStatement();

            // decleare parameters
            List<CodeArgumentReferenceExpression> codeParamiteRefrs = new List<CodeArgumentReferenceExpression>();

            foreach (ParameterInfo codeParameter in method.GetParameters()) {
                CodeParameterDeclarationExpression codeParameterDeclare = new CodeParameterDeclarationExpression(codeParameter.ParameterType, codeParameter.Name);
                codeMethod.Parameters.Add(codeParameterDeclare);
                codeParamiteRefrs.Add(new CodeArgumentReferenceExpression(codeParameter.Name));
            }

            // invoke
            CodeMethodInvokeExpression invokeMethod = new CodeMethodInvokeExpression(
                inner, method.Name, codeParamiteRefrs.ToArray());
            if (method.ReturnType.Name.ToLower() == "void") {
                tryCode.TryStatements.Add(invokeMethod);
            } else {
                CodeVariableDeclarationStatement var = new CodeVariableDeclarationStatement(method.ReturnType, "returnObject", invokeMethod);
                //CodeAssignStatement assign = new CodeAssignStatement(var, invokeMethod);
                tryCode.TryStatements.Add(var);

                CodeCommentStatement todo = new CodeCommentStatement("TODO: your code", false);
                tryCode.TryStatements.Add(todo);

                CodeVariableReferenceExpression varRef = new CodeVariableReferenceExpression("returnObject");
                CodeMethodReturnStatement codeReturn = new CodeMethodReturnStatement(varRef);
                tryCode.TryStatements.Add(codeReturn);
            }

            // catch
            CodeTypeReference codeTypeRef = new CodeTypeReference(typeof(Exception));
            CodeCatchClause catchClause = new CodeCatchClause("ex", codeTypeRef);
            catchClause.Statements.Add(new CodeThrowExceptionStatement());
            tryCode.CatchClauses.Add(catchClause);

            codeMethod.Statements.Add(tryCode);
            return codeMethod;
        }
 public CodeParameterDeclarationExpressionCollection GenerateMethodsParameters()
 {
     var sqlQuery = new CodeParameterDeclarationExpression ("System.String", "query");
     var sqlQueryParameter = new CodeParameterDeclarationExpression () {
         Type = new CodeTypeReference ("System.Object"),
         Name = "paramater = null",
     // TODO : find a way to do it properly
     //				CustomAttributes = new CodeAttributeDeclarationCollection {
     //					new CodeAttributeDeclaration ("Optional")
     //				}
     };
     var parameters = new CodeParameterDeclarationExpressionCollection ();
     parameters.Add (sqlQuery);
     parameters.Add (sqlQueryParameter);
     return parameters;
 }
Exemplo n.º 25
0
        /*private void GenerateMethods(CodeTypeDeclaration tgtType)
        {
            foreach (GMethod method in type.Methods)
            {
                CreateMethodSignature(tgtType, method, false);
            }
        }*/
        private CodeMemberMethod CreateConstructorHelper(GMethod constructor, string uName)
        {
            var tgtMethod = new CodeMemberMethod();
            tgtMethod.Name = uName;
            tgtMethod.Attributes = MemberAttributes.Static | MemberAttributes.Private | MemberAttributes.New;
            Utils.AddAttribute(tgtMethod, "net.sf.jni4net.attributes.ClrMethod", constructor.CLRSignature);

            // inject thiz parameter
            var tgtParameter = new CodeParameterDeclarationExpression();
            tgtParameter.Name = "thiz";
            tgtParameter.Type = constructor.Type.CLRReference;
            tgtMethod.Parameters.Add(tgtParameter);

            GenerateParameters(constructor, tgtMethod);

            return tgtMethod;
        }
Exemplo n.º 26
0
        private CodeMemberMethod ApplyMethod(ParseTreeNode node)
        {
            var parameterType = new CodeTypeReference(typeof (IActivityContext));
            var returnType = new CodeTypeReference(typeof (bool));
            var contextParameter = new CodeParameterDeclarationExpression(parameterType, "context");

            var method = new CodeMemberMethod
                             {
                                 Attributes = MemberAttributes.Public | MemberAttributes.Override,
                                 Name = "Apply",
                                 ReturnType = returnType
                             };

            method.Parameters.Add(contextParameter);
            method.Statements.Add(new CodeMethodReturnStatement(Generate(node)));
            return method;
        }
        internal StandardBindingSectionGenerator(Type standardBindingType, Assembly userAssembly, CodeDomProvider provider)
        {
            this.standardBindingType = standardBindingType;
            this.userAssembly = userAssembly;
            this.provider = provider;

            this.generatedElementClassName = standardBindingType.Name + Constants.ElementSuffix;
            this.constantsClassName = standardBindingType.Name.Substring(0, standardBindingType.Name.IndexOf(TypeNameConstants.Binding)) + Constants.ConfigurationStrings;
            this.defaultValuesClassName = standardBindingType.Name.Substring(0, standardBindingType.Name.IndexOf(TypeNameConstants.Binding)) + Constants.Defaults;
            this.generatedCollectionElementClassName = standardBindingType.Name + Constants.CollectionElementSuffix;

            this.customSBTypeRef = new CodeTypeReference(standardBindingType.Name);
            this.customSBTypeOfRef = new CodeTypeOfExpression(customSBTypeRef);
            this.bindingMethodParamRef = new CodeParameterDeclarationExpression(
                                            CodeDomHelperObjects.bindingTypeRef, 
                                            Constants.bindingParamName);
        }
Exemplo n.º 28
0
        public static void GenerateConstructor(CodeTypeDeclaration classDecl)
        {
            CodeConstructor constructorMember = new CodeConstructor() ;

            constructorMember.Attributes = MemberAttributes.Public;

            CodeParameterDeclarationExpression parameter = new CodeParameterDeclarationExpression(new CodeTypeReference("IContext"), "context");
            constructorMember.Parameters.Add(parameter);

            CodeThisReferenceExpression thisExp = new CodeThisReferenceExpression();
            CodeFieldReferenceExpression ctxFieldExp = new CodeFieldReferenceExpression(thisExp, "context");

            CodeArgumentReferenceExpression argExp = new CodeArgumentReferenceExpression("context");
            CodeAssignStatement assignStatement = new CodeAssignStatement(ctxFieldExp, argExp);
            constructorMember.Statements.Add(assignStatement);

            classDecl.Members.Add(constructorMember);
        }
Exemplo n.º 29
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public CodeMemberMethod BuildSelectBE(TableViewTableTypeBase table)
        {
            CodeMemberMethod cmSelect = new CodeMemberMethod();
            cmSelect.Attributes = MemberAttributes.Public;
            cmSelect.ReturnType = new CodeTypeReference("System.Data.DataSet");
            String cp_name = "ssp_" + table.Name;
            String PocoTypeName = table.Name;
            String FullPocoTypeName = PocoTypeName;

            CodeParameterDeclarationExpression cpdePoco = new CodeParameterDeclarationExpression();
            cpdePoco.Name = "query";
            cpdePoco.Type = new CodeTypeReference(table.Name);
            cpdePoco.Direction = FieldDirection.In;
            cmSelect.Parameters.Add(cpdePoco);
            cmSelect.Attributes = MemberAttributes.Public;
            cmSelect.Name = "Select";
            cmSelect.Statements.Add(new CodeSnippetExpression("this.Access.CreateProcedureCommand(\"" + cp_name + "\")"));

            foreach (Column c in table.Columns)
            {
                MemberGraph mGraph = new MemberGraph(c);
                String DotNetTypeName = TypeConvertor.ToNetType(c.DataType.SqlDataType).ToString();

                System.CodeDom.CodeConditionStatement ccsField = new CodeConditionStatement();
                if (mGraph.IsNullable)
                {
                    ccsField.Condition = new CodeSnippetExpression("query." + mGraph.PropertyName() + ".HasValue");
                    ccsField.TrueStatements.Add(new CodeSnippetExpression("this.Access.AddParameter(\"" + mGraph.PropertyName() + "\",query." + mGraph.PropertyName() + ".Value, ParameterDirection.Input)"));
                    ccsField.FalseStatements.Add(new CodeSnippetExpression("this.Access.AddParameter(\"" + mGraph.PropertyName() + "\", null , ParameterDirection.Input)"));
                }
                else
                {
                    ccsField.Condition = new CodeSnippetExpression("query." + mGraph.PropertyName() + " == null");
                    ccsField.TrueStatements.Add(new CodeSnippetExpression("this.Access.AddParameter(\"" + mGraph.PropertyName() + "\", null , ParameterDirection.Input)"));
                    ccsField.FalseStatements.Add(new CodeSnippetExpression("this.Access.AddParameter(\"" + mGraph.PropertyName() + "\",query." + mGraph.PropertyName() + ", ParameterDirection.Input)"));
                }

                cmSelect.Statements.Add(ccsField);
            }

            cmSelect.Statements.Add(new CodeSnippetExpression("return this.Access.ExecuteDataSet()"));
            cmSelect.Comments.Add(new CodeCommentStatement("Select by Object [Implements Query By Example], returns DataSet"));
            return cmSelect;
        }
Exemplo n.º 30
0
        /// <summary>
        /// Defines and returns a constructor for the given type
        /// </summary>
        /// <param name="container"></param>
        /// <param name="modifier"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static CodeConstructor DefineConstructor(CodeTypeDeclaration container,
            ModifierEnum modifier, params ParameterInfo[] parameters)
        {
            CodeConstructor ctor = new CodeConstructor();
            ctor.Attributes = (ctor.Attributes & ~MemberAttributes.AccessMask) | (MemberAttributes)modifier;

            if (parameters != null)
            {
                foreach (ParameterInfo parameter in parameters)
                {
                    CodeParameterDeclarationExpression codeParameter = new CodeParameterDeclarationExpression(
                        parameter.ParameterType, parameter.Name);
                    ctor.Parameters.Add(codeParameter);
                }
            }

            container.Members.Add(ctor);
            return ctor;
        }
Exemplo n.º 31
0
        private CodeParam CloneParamImpl(CodeParam param, bool copyAttrib)
        {
            if (param == null)
            {
                return(null);
            }

            CodeParam clone = new CodeParam();

            clone.Name      = param.Name;
            clone.Direction = param.Direction;
            clone.Type      = CloneTypeReference(param.Type);

            if (copyAttrib)
            {
                CloneCustomAttributes(param.CustomAttributes, clone.CustomAttributes);
            }

            return(clone);
        }
Exemplo n.º 32
0
        public async System.Threading.Tasks.Task GCode_CodeDom_GenerateMethodCode(CodeTypeDeclaration codeClass, LinkPinControl element, GenerateCodeContext_Class context, MethodGenerateData data)
        {
            var csParam = CSParam as MethodOverrideConstructParam;

            Type[] paramTypes = new Type[csParam.MethodInfo.Params.Count];
            for (int i = 0; i < paramTypes.Length; i++)
            {
                switch (csParam.MethodInfo.Params[i].FieldDirection)
                {
                case FieldDirection.In:
                    if (csParam.MethodInfo.Params[i].IsParamsArray)
                    {
                        throw new InvalidOperationException("未实现");
                    }
                    else
                    {
                        paramTypes[i] = csParam.MethodInfo.Params[i].ParameterType;
                    }
                    break;

                case FieldDirection.Out:
                case FieldDirection.Ref:
                    if (csParam.MethodInfo.Params[i].IsParamsArray)
                    {
                        throw new InvalidOperationException("未实现");
                    }
                    else
                    {
                        paramTypes[i] = csParam.MethodInfo.Params[i].ParameterType.MakeByRefType();
                    }
                    break;
                }
            }
            EngineNS.Editor.MacrossMemberAttribute.enMacrossType macrossType = EngineNS.Editor.MacrossMemberAttribute.enMacrossType.Overrideable;
            if (csParam.MethodInfo.IsFromMacross)
            {
                macrossType |= EngineNS.Editor.MacrossMemberAttribute.enMacrossType.Callable;
            }
            else
            {
                var methodInfo = csParam.MethodInfo.ParentClassType.GetMethod(csParam.MethodInfo.MethodName, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static, null, paramTypes, null);
                var atts       = methodInfo.GetCustomAttributes(typeof(EngineNS.Editor.MacrossMemberAttribute), false);
                if (atts.Length > 0)
                {
                    var macrossMemberAtt = atts[0] as EngineNS.Editor.MacrossMemberAttribute;
                    macrossType = macrossMemberAtt.MacrossType;
                }
            }

            if (element == null || element == mCtrlMethodPin_Next)
            {
                var methodCode = new CodeGenerateSystem.CodeDom.CodeMemberMethod();
                methodCode.Attributes = MemberAttributes.Override;
                //if (mMethodInfo != null)
                //{
                if (csParam.MethodInfo.IsFamily)
                {
                    methodCode.Attributes |= MemberAttributes.Family;
                }
                if (csParam.MethodInfo.IsFamilyAndAssembly)
                {
                    methodCode.Attributes |= MemberAttributes.FamilyAndAssembly;
                }
                if (csParam.MethodInfo.IsFamilyOrAssembly)
                {
                    methodCode.Attributes |= MemberAttributes.FamilyOrAssembly;
                }
                if (csParam.MethodInfo.IsPublic)
                {
                    methodCode.Attributes |= MemberAttributes.Public;
                }
                //}
                //else
                //    methodCode.Attributes |= MemberAttributes.Public;
                methodCode.Name = NodeName;

                var mcType = EngineNS.Editor.MacrossMemberAttribute.enMacrossType.Unknow;
                if (csParam.MethodInfo.MC_Callable)
                {
                    mcType = mcType | EngineNS.Editor.MacrossMemberAttribute.enMacrossType.Callable;
                }
                if (csParam.MethodInfo.MC_Overrideable)
                {
                    mcType = mcType | EngineNS.Editor.MacrossMemberAttribute.enMacrossType.Overrideable;
                }
                if (mcType != EngineNS.Editor.MacrossMemberAttribute.enMacrossType.Unknow)
                {
                    methodCode.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(EngineNS.Editor.MacrossMemberAttribute)), new CodeAttributeArgument(new CodePrimitiveExpression(mcType))));
                }

                if (data != null)
                {
                    foreach (var localParam in data.LocalParams)
                    {
                        var defVal  = CodeGenerateSystem.Program.GetDefaultValueFromType(localParam.ParamType);
                        var initExp = Program.GetValueCode(methodCode.Statements, localParam.ParamType, defVal);
                        methodCode.Statements.Add(new CodeVariableDeclarationStatement(localParam.ParamType, localParam.ParamName, initExp));
                    }
                }

                string paramPreStr = "temp___";
                //bool needUnsafeFlag = false;
                string catchParamName = "(";
                foreach (var paramNode in mChildNodes)
                {
                    var paramExp = new System.CodeDom.CodeParameterDeclarationExpression();
                    if (paramNode is MethodInvokeParameterControl)
                    {
                        var pm      = paramNode as MethodInvokeParameterControl;
                        var pmParam = pm.CSParam as MethodInvokeParameterControl.MethodInvokeParameterConstructionParams;
                        paramExp.Direction = pm.ParamFlag;
                        if (pmParam.ParamInfo.ParameterDisplayType != null)
                        {
                            paramExp.Name = paramPreStr + pmParam.ParamInfo.ParamName;
                            paramExp.Type = new CodeTypeReference(pmParam.ParamInfo.ParameterType);
                        }
                        else
                        {
                            paramExp.Name = pmParam.ParamInfo.ParamName;
                            paramExp.Type = new System.CodeDom.CodeTypeReference(pm.ParamType);
                        }

                        //if (pm.ParamType.IsPointer)
                        //    needUnsafeFlag = true;
                    }
                    else if (paramNode is ParamParameterControl)
                    {
                        var pm = paramNode as ParamParameterControl;
                        paramExp.Name = pm.ParamName;
                        paramExp.Type = new System.CodeDom.CodeTypeReference(pm.ParamType);

                        //if (pm.ParamType.IsPointer)
                        //    needUnsafeFlag = true;
                    }
                    else if (paramNode is MethodInvoke_DelegateControl)
                    {
                        var pm = paramNode as MethodInvoke_DelegateControl;
                        paramExp.Name = pm.ParamName;
                        paramExp.Type = new System.CodeDom.CodeTypeReference(pm.ParamType);
                    }

                    methodCode.Parameters.Add(paramExp);
                    catchParamName += paramExp.Type + " " + paramExp.Name + ",";
                }
                // 所有函数全部unsafe
                //if (needUnsafeFlag)
                {
                    //var typeName = MethodReturnType.FullName;
                    methodCode.ReturnType = new CodeTypeReference(MethodReturnType);
                    if (MethodReturnType == typeof(System.Threading.Tasks.Task) || MethodReturnType.BaseType == typeof(System.Threading.Tasks.Task))
                    {
                        methodCode.IsAsync = true;
                    }
                    else
                    {
                        if (EngineNS.Editor.MacrossMemberAttribute.HasType(macrossType, EngineNS.Editor.MacrossMemberAttribute.enMacrossType.Unsafe))
                        {
                            methodCode.IsUnsafe = true;
                        }
                    }
                }
                //else
                //    methodCode.ReturnType = new CodeTypeReference(MethodReturnType);

                catchParamName  = catchParamName.TrimEnd(',');
                catchParamName += ")";

                var tryCatchExp = new System.CodeDom.CodeTryCatchFinallyStatement();
                tryCatchExp.TryStatements.Add(new CodeGenerateSystem.CodeDom.CodeMethodInvokeExpression(new CodeVariableReferenceExpression(context.ScopFieldName), "Begin", new CodeExpression[0]));
                var exName = "ex_" + EngineNS.Editor.Assist.GetValuedGUIDString(Id);
                var cah    = new System.CodeDom.CodeCatchClause(exName);
                cah.Statements.Add(new System.CodeDom.CodeExpressionStatement(
                                       new CodeGenerateSystem.CodeDom.CodeMethodInvokeExpression(
                                           new System.CodeDom.CodeSnippetExpression("EngineNS.Profiler.Log"), "WriteException",
                                           new System.CodeDom.CodeVariableReferenceExpression(exName),
                                           new CodePrimitiveExpression("Macross异常"))));
                tryCatchExp.CatchClauses.Add(cah);
                tryCatchExp.FinallyStatements.Add(new CodeGenerateSystem.CodeDom.CodeMethodInvokeExpression(new CodeVariableReferenceExpression(context.ScopFieldName), "End", new CodeExpression[0]));

                string paramComment = "";
                // 设置out参数默认值
                foreach (var param in csParam.MethodInfo.Params)
                {
                    if (param.ParameterDisplayType != null)
                    {
                        if (param.FieldDirection == FieldDirection.Out)
                        {
                            methodCode.Statements.Add(new CodeAssignStatement(new CodeVariableReferenceExpression(paramPreStr + param.ParamName),
                                                                              new CodePrimitiveExpression(CodeGenerateSystem.Program.GetDefaultValueFromType(param.ParameterType))));
                        }
                        methodCode.Statements.Add(new CodeVariableDeclarationStatement(param.ParameterDisplayType, param.ParamName, new CodeGenerateSystem.CodeDom.CodeCastExpression(param.ParameterDisplayType, new CodeVariableReferenceExpression(paramPreStr + param.ParamName))));
                    }
                    else
                    {
                        if (param.FieldDirection == FieldDirection.Out)
                        {
                            methodCode.Statements.Add(new CodeAssignStatement(new CodeVariableReferenceExpression(param.ParamName),
                                                                              new CodePrimitiveExpression(CodeGenerateSystem.Program.GetDefaultValueFromType(param.ParameterType))));
                        }
                    }

                    paramComment += param.FieldDirection + "," + param.ParameterType.FullName + "|";
                }
                paramComment = paramComment.TrimEnd('|');

                methodCode.Statements.Add(tryCatchExp);
                foreach (var param in csParam.MethodInfo.Params)
                {
                    // ref或out,需要将displayType造成的临时变量再赋给原函数参数
                    if ((param.FieldDirection == FieldDirection.Out || param.FieldDirection == FieldDirection.Ref) && param.ParameterDisplayType != null)
                    {
                        methodCode.Statements.Add(new CodeAssignStatement(new CodeVariableReferenceExpression(paramPreStr + param.ParamName), new CodeGenerateSystem.CodeDom.CodeCastExpression(param.ParameterType, new CodeVariableReferenceExpression(param.ParamName))));
                    }
                }

                if (csParam.MethodInfo.ReturnType != typeof(void) && csParam.MethodInfo.ReturnType != typeof(System.Threading.Tasks.Task))
                {
                    var retVal = CodeGenerateSystem.Program.GetDefaultValueFromType(csParam.MethodInfo.ReturnType);
                    methodCode.Statements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression(retVal)));
                }


                if (csParam.MethodInfo.IsFromMacross)
                {
                    codeClass.Members.Add(new CodeSnippetTypeMember($"// OverrideStart {csParam.MethodInfo.FuncId.ToString()} {NodeName} {paramComment}"));
                    codeClass.Members.Add(new CodeSnippetTypeMember("#pragma warning disable 1998"));
                    codeClass.Members.Add(methodCode);
                    codeClass.Members.Add(new CodeSnippetTypeMember("#pragma warning restore 1998"));
                    codeClass.Members.Add(new CodeSnippetTypeMember($"// OverrideEnd {csParam.MethodInfo.FuncId.ToString()} {NodeName}"));
                }
                else
                {
                    codeClass.Members.Add(new CodeSnippetTypeMember($"// OverrideStart {NodeName} {paramComment}"));
                    codeClass.Members.Add(new CodeSnippetTypeMember("#pragma warning disable 1998"));
                    codeClass.Members.Add(methodCode);
                    codeClass.Members.Add(new CodeSnippetTypeMember("#pragma warning restore 1998"));
                    codeClass.Members.Add(new CodeSnippetTypeMember($"// OverrideEnd {NodeName}"));
                }

                var methodContext = new CodeGenerateSystem.Base.GenerateCodeContext_Method(context, methodCode);
                // 收集用于调试的数据的代码
                var debugCodes = CodeDomNode.BreakPoint.BeginMacrossDebugCodeStatments(tryCatchExp.TryStatements);
                foreach (var paramNode in mChildNodes)
                {
                    if (paramNode is MethodInvokeParameterControl)
                    {
                        var paramCtrl = paramNode as MethodInvokeParameterControl;
                        CodeDomNode.BreakPoint.GetGatherDataValueCodeStatement(debugCodes, paramCtrl.ParamPin.GetLinkPinKeyName(), paramCtrl.GCode_CodeDom_GetValue(paramCtrl.ParamPin, methodContext), paramCtrl.GCode_GetTypeString(paramCtrl.ParamPin, methodContext), methodContext);
                    }
                    else if (paramNode is ParamParameterControl)
                    {
                        throw new InvalidOperationException();
                    }
                }
                // 断点
                var breakCondStatement = CodeDomNode.BreakPoint.BreakCodeStatement(codeClass, debugCodes, HostNodesContainer.GUID, Id);
                // 设置数据
                foreach (var paramNode in mChildNodes)
                {
                    if (paramNode is MethodInvokeParameterControl)
                    {
                        var paramCtrl = paramNode as MethodInvokeParameterControl;
                        CodeDomNode.BreakPoint.GetSetDataValueCodeStatement(breakCondStatement.TrueStatements, paramCtrl.ParamPin.GetLinkPinKeyName(), paramCtrl.GCode_CodeDom_GetValue(paramCtrl.ParamPin, methodContext), paramCtrl.GCode_GetType(paramCtrl.ParamPin, methodContext));
                    }
                    else if (paramNode is ParamParameterControl)
                    {
                        throw new InvalidOperationException();
                    }
                }
                CodeDomNode.BreakPoint.EndMacrossDebugCodeStatements(tryCatchExp.TryStatements, debugCodes);

                if (mCtrlMethodPin_Next.HasLink)
                {
                    methodContext.ReturnValueType = MethodReturnType;
                    await mCtrlMethodPin_Next.GetLinkedObject(0, false).GCode_CodeDom_GenerateCode(codeClass, tryCatchExp.TryStatements, mCtrlMethodPin_Next.GetLinkedPinControl(0, false), methodContext);
                }
            }
        }
 public int Add(CodeParameterDeclarationExpression value) => List.Add(value);
 public bool Contains(CodeParameterDeclarationExpression value) => List.Contains(value);
 public int IndexOf(CodeParameterDeclarationExpression value) => List.IndexOf(value);
 /// <include file='doc\CodeParameterDeclarationExpressionCollection.uex' path='docs/doc[@for="CodeParameterDeclarationExpressionCollection.Remove"]/*' />
 /// <devdoc>
 ///    <para> Removes a specific <see cref='System.CodeDom.CodeParameterDeclarationExpression'/> from the
 ///    <see cref='System.CodeDom.CodeParameterDeclarationExpressionCollection'/> .</para>
 /// </devdoc>
 public void Remove(CodeParameterDeclarationExpression value)
 {
     List.Remove(value);
 }
 /// <include file='doc\CodeParameterDeclarationExpressionCollection.uex' path='docs/doc[@for="CodeParameterDeclarationExpressionCollection.Contains"]/*' />
 /// <devdoc>
 /// <para>Gets a value indicating whether the
 ///    <see cref='System.CodeDom.CodeParameterDeclarationExpressionCollection'/> contains the specified <see cref='System.CodeDom.CodeParameterDeclarationExpression'/>.</para>
 /// </devdoc>
 public bool Contains(CodeParameterDeclarationExpression value)
 {
     return(List.Contains(value));
 }
 /// <include file='doc\CodeParameterDeclarationExpressionCollection.uex' path='docs/doc[@for="CodeParameterDeclarationExpressionCollection.IndexOf"]/*' />
 /// <devdoc>
 ///    <para>Returns the index of a <see cref='System.CodeDom.CodeParameterDeclarationExpression'/> in
 ///       the <see cref='System.CodeDom.CodeParameterDeclarationExpressionCollection'/> .</para>
 /// </devdoc>
 public int IndexOf(CodeParameterDeclarationExpression value)
 {
     return(List.IndexOf(value));
 }
Exemplo n.º 39
0
 public CodeParam CloneParam(CodeParam param)
 {
     return(CloneParamImpl(param, true));
 }
Exemplo n.º 40
0
 public CodeParam CloneParamNoAttributes(CodeParam param)
 {
     return(CloneParamImpl(param, false));
 }
 /// <include file='doc\CodeParameterDeclarationExpressionCollection.uex' path='docs/doc[@for="CodeParameterDeclarationExpressionCollection.Add"]/*' />
 /// <devdoc>
 ///    <para>Adds a <see cref='System.CodeDom.CodeParameterDeclarationExpression'/> with the specified value to the
 ///    <see cref='System.CodeDom.CodeParameterDeclarationExpressionCollection'/> .</para>
 /// </devdoc>
 public int Add(CodeParameterDeclarationExpression value)
 {
     return(List.Add(value));
 }
 public bool Contains(CodeParameterDeclarationExpression value)
 {
     return(default(bool));
 }
 public int Add(CodeParameterDeclarationExpression value)
 {
     return(default(int));
 }
 /// <include file='doc\CodeParameterDeclarationExpressionCollection.uex' path='docs/doc[@for="CodeParameterDeclarationExpressionCollection.Insert"]/*' />
 /// <devdoc>
 /// <para>Inserts a <see cref='System.CodeDom.CodeParameterDeclarationExpression'/> into the <see cref='System.CodeDom.CodeParameterDeclarationExpressionCollection'/> at the specified index.</para>
 /// </devdoc>
 public void Insert(int index, CodeParameterDeclarationExpression value)
 {
     List.Insert(index, value);
 }