开发者

C# CodeModel Find out if CodeParameter is out or ref

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜