小编Jah*_*ack的帖子

如何在资源文件中使用字符串插值?

我想使用资源文件发送电子邮件.在我的资源文件中,我使用了一个变量"EmailConfirmation",其值为"Hello {userName} ..."

在我的班上我用过:

public static string message (string userName)
{
   return Resource.WebResource.EmailConfirmation
}
Run Code Online (Sandbox Code Playgroud)

问题是返回表示"Hello {userName}"而不是"Hello Toto".

c# variables interpolation resource-files string-formatting

8
推荐指数
1
解决办法
2265
查看次数