需要初始化对象的新实例
以下代码:
CodeVariableDeclarationStatement variableDeclaration = new CodeVariableDeclarationStatement(
// Type of the variable to declare.
typeof(string),
// Name of the variable to declare.
"TestString");
生成以下 VB.Net 语句:
Dim TestString As String
我需要进行哪些更改才能使其看起来像这样:
Dim TestString As New StringBuilder()
我对如何显示 NEW 关键字感兴趣。
The following code:
CodeVariableDeclarationStatement variableDeclaration = new CodeVariableDeclarationStatement(
// Type of the variable to declare.
typeof(string),
// Name of the variable to declare.
"TestString");
Produces the following VB.Net Statement:
Dim TestString As String
What change would I need to make for it to look like this:
Dim TestString As New StringBuilder()
I'm interested in how to get that NEW keyword to appear.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在构造函数中添加一个
CodeObjectCreateExpression
作为第三个参数:Add a
CodeObjectCreateExpression
as a 3rd argument in the constructor: