.net - 变量替换为字符串

标签 .net vb.net

我可以做类似 "%s said %s blah.", $name, $blah; 的事情吗?在 VB.NET 中?

写作越来越痛苦name & "said" & blah & "blah" .

最佳答案

在 VB.NET 14(对于 VS2015)中,您可以使用 string interpolation :

Dim newString As String = $"{name} said {blah} blah."

关于.net - 变量替换为字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2210574/

相关文章:

c# - 学习 C# 和方法内部的对象让我感到困惑

c# - 无法将 lambda 表达式转换为类型 'string',因为它不是委托(delegate)类型

asp.net - 在 Microsoft Windows Azure 上设置网站的默认网页

.net 收藏 : how to copy objects from one collection to another?

c# - 如何在 Windows PowerShell 4.0 中执行短路评估?

vb.net - 是否可以查看数据表行中的下一个值?

.net - 为什么需要锁来实现 readonly int 属性?

.net - 如何在 F# 中学习 GUI 编程

.net - 在.net应用程序中播放声音的更好的解决方案是什么:DirectX lib或System.Media.SoundPlayer的音频?

vb.net - 我做错了什么: Structure cannot be indexed because it has no default property (WITH CLAUSE)