CodeDomProvider generates parameters with ampersand operator instead of ref keyword

13 views Asked by At

I'm trying to generate code from an object I mined the reflection objects for. The object browser shows the method signature is

public string[] GetRunningProgram(int intRow, int intColumn, ref int pintReadPoint, ref int pintExecutePoint)

I'm using the following code to generate the c# code

CodeDomProvider provider = CodeDomProvider.CreateProvider("CSharp");
CodeGeneratorOptions options = new CodeGeneratorOptions();
options.BracingStyle = "C";
using (StreamWriter sourceWriter = new StreamWriter(source_name)) {
   provider.GenerateCodeFromCompileUnit(targetUnit, sourceWriter, options);
}

FileInfo sourceFile = new FileInfo(Path.Combine(Environment.CurrentDirectory,"MockOkuma.cs"));

which give me the following signature:

public virtual string[] GetRunningProgram(int intRow, int intColumn, System.Int32& pintReadPoint, System.Int32& pintExecutePoint)

How do I get the CodeDomProvider to output the ref keyword instead of the ampersand operator?

0

There are 0 answers