csharp System.CodeDom.CodeParameterDeclarationExpression类(方法)实例源码

下面列出了csharp System.CodeDom.CodeParameterDeclarationExpression 类(方法)源码代码实例,从而了解它的用法。

作者:.NET开发    项目:System.CodeDo   
// Declares a method.
CodeMemberMethod method1 = new CodeMemberMethod();
method1.Name = "TestMethod";

// Declares a string parameter passed by reference.
CodeParameterDeclarationExpression param1 = new CodeParameterDeclarationExpression("System.String", "stringParam");
param1.Direction = FieldDirection.Ref;
method1.Parameters.Add(param1);

// Declares a Int32 parameter passed by incoming field.
CodeParameterDeclarationExpression param2 = new CodeParameterDeclarationExpression("System.Int32", "intParam");
param2.Direction = FieldDirection.Out;
method1.Parameters.Add(param2);

// A C# code generator produces the following source code for the preceeding example code:

//        private void TestMethod(ref string stringParam, out int intParam) {
//        }


问题


面经


文章

微信
公众号

扫码关注公众号