CodeModel基类构造函数调用. [英] CodeModel baseclass constructor call.

查看:83
本文介绍了CodeModel基类构造函数调用.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地将构造函数添加到csharp文档的代码模型中.问题是在我的情况下,我必须手动将调用添加到":base(savePath)" .

 

                var ctr = resultClass.AddFunction(resultClass.Name, vsCMFunction.vsCMFunctionConstructor, null, -1,
                                                  vsCMAccess.vsCMAccessPublic, null);
                ctr.AddParameter("savePath", "String", -1);
                var ep = ctr.StartPoint.CreateEditPoint();
                ep.EndOfLine();
                ep.Insert(": base(savePath)");

解决方案



Jwize,据我所知,我们只能使用CodeModel . AddFunction方法来创建新的功能代码构造,
但是此函数不能添加:base(savePath)",所以我认为没有更好的选择了
执行此操作的方式.



I have been successfully able to add a constructor to the code model of my csharp document. The problem is I have to manually add the call to the ": base(savePath)" in my case. 

 

                var ctr = resultClass.AddFunction(resultClass.Name, vsCMFunction.vsCMFunctionConstructor, null, -1,
                                                  vsCMAccess.vsCMAccessPublic, null);
                ctr.AddParameter("savePath", "String", -1);
                var ep = ctr.StartPoint.CreateEditPoint();
                ep.EndOfLine();
                ep.Insert(": base(savePath)");

解决方案



Jwize, based on my knowledge, we only can use the CodeModel.AddFunction Method to create a new function code construct ,
but this function cannot add ":base(savePath)", so I think there is no better
way to perform this.



这篇关于CodeModel基类构造函数调用.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆