【问题标题】:How to write all three values using the resxresourcewriter?如何使用 resxresourcewriter 写入所有三个值?
【发布时间】:2011-05-13 18:39:57
【问题描述】:

http://msdn.microsoft.com/en-us/library/system.resources.resxresourcewriter.aspx

在这个链接和其他类似的链接中,我看到了写在“名称”和“值”中的代码,但没有看到“评论”。我大量使用评论字段。是否有同时访问所有 3 个或单独访问评论字段的代码?还是我必须直接操作 XML?

【问题讨论】:

  • 有人使用 ResxResourceWriter 吗?

标签: asp.net resources localization resx


【解决方案1】:

显然您可以在ResXDataNode 对象上设置评论。然后,您可以使用ResXResourceWriter.AddResource(ResXDataNode) 方法编写 ResXDataNode。

resxWriter.AddResource(new ResXDataNode("key", "value") { Comment="comment" });

来源:http://www.codeproject.com/KB/dotnet/ResxSync.aspx?msg=1708100(在主文章后,评论“评论可以访问[修改]”)

【讨论】:

  • 这适用于 C# 2.0 以上版本。因此,为了在 C# 2.0 中使用它,我使用了以下内容。 ResXDataNode dataNode = new ResXDataNode("key", "value"); dataNode.Comment = "Comment"; resxWriter.AddResource(dataNode);
猜你喜欢
  • 2021-07-05
  • 2019-03-02
  • 1970-01-01
  • 2012-07-07
  • 2018-02-02
  • 1970-01-01
  • 1970-01-01
  • 2011-05-05
  • 2019-03-03
相关资源
最近更新 更多