views:

22

answers:

1

I am using CodeModel inside of a T4 template to generate some code based from an interface. I am able to get the interface methods, parameter names, and parameter types but I can't seem to be able to find out wither the parameter is an out or ref parameter.

http://msdn.microsoft.com/en-us/library/envdte.codeparameter.aspx

foreach ( CodeElement child in func.Children )
        {
            CodeParameter param = child as CodeParameter;
            if ( param != null ) 
            {
                Write("{0}{1} {2}", nextString, param.Type.AsString, param.Name);
                nextString = ", ";
            }
        }

Any ideas on how to get this information?

A: 

http://www.visualstudiodev.com/visual-studio-extensibility/codemodel-alternatives-11973.shtml
According to that link you can cast it to CodeParameter2 and which has a property ParameterKind which differenciates ref and out.

CodeInChaos