我在其中运行VSIX的项目中的功能是这个;
public void Method1(string name, out int age)
{
age = 0;
int g1 = 0;
//
int g = 0;
}
并且要通过功能参数的VSIX项目代码为
// Here 'codeElement' is the Function Having Parameters.
foreach (CodeElement codeElement2 in codeElement.Children)
{
if (codeElement2.Kind == vsCMElement.vsCMElementParameter)
{
string parameterName = codeElement2.Name;
string parameterDataType = ((CodeParameter)codeElement2).Type.AsString;
VsShellUtilities.ShowMessageBox(
this.package,
">>>>>" + " : " + parameterName + " : " + parameterDataType,
"MESSAGE...",
OLEMSGICON.OLEMSGICON_INFO,
OLEMSGBUTTON.OLEMSGBUTTON_OK,
OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
}
此代码可以正常工作,它给出了参数的名称及其数据类型。
如何获取参数是'out','ref'还是值类型?
((就像Method1中的参数'age'是'out')] >>
我在其中运行VSIX的项目中的功能是这样;公共无效Method1(字符串名称,超出int年龄){age = 0; int g1 = 0; // int g = 0; ...
使用包含更多信息的CodeParameter2界面: